]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: adc: pac1934: Return -ENOMEM on memory allocation failure
authorAntoniu Miclaus <antoniu.miclaus@analog.com>
Wed, 11 Feb 2026 17:10:05 +0000 (19:10 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 23 Feb 2026 08:24:22 +0000 (08:24 +0000)
devm_kzalloc() returns NULL on allocation failure. The appropriate error
code for this condition is -ENOMEM, not -EINVAL.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/pac1934.c

index 712b5e9caba6df03647ec5b8341bcc8f5bb3d3d7..23055405a6e0cb7a537f4df82248d59c2613745e 100644 (file)
@@ -1351,7 +1351,7 @@ static int pac1934_prep_iio_channels(struct pac1934_chip_info *info, struct iio_
 
        dyn_ch_struct = devm_kzalloc(dev, channel_size, GFP_KERNEL);
        if (!dyn_ch_struct)
-               return -EINVAL;
+               return -ENOMEM;
 
        tmp_data = dyn_ch_struct;