]> git.baikalelectronics.ru Git - kernel.git/commitdiff
iio: adc: xilinx-ams: fix devm_krealloc() return value check
authorMarco Pagani <marpagan@redhat.com>
Fri, 25 Nov 2022 11:31:12 +0000 (12:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:17 +0000 (11:28 +0100)
commit 6794ed0cfcc6ce737240eccc48b3e8190df36703 upstream.

The clang-analyzer reported a warning: "Value stored to 'ret'
is never read".

Fix the return value check if devm_krealloc() fails to resize
ams_channels.

Fixes: 2abafc0ce6f6 ("iio: adc: Add Xilinx AMS driver")
Signed-off-by: Marco Pagani <marpagan@redhat.com>
Acked-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221125113112.219290-1-marpagan@redhat.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/xilinx-ams.c

index 5b4bdf3a26bb8a942151ddbdea53dc3ec6a8f5ad..a507d2e17079286797a726fb52563346525a2393 100644 (file)
@@ -1329,7 +1329,7 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
 
        dev_channels = devm_krealloc(dev, ams_channels, dev_size, GFP_KERNEL);
        if (!dev_channels)
-               ret = -ENOMEM;
+               return -ENOMEM;
 
        indio_dev->channels = dev_channels;
        indio_dev->num_channels = num_channels;