From: Marco Pagani Date: Fri, 25 Nov 2022 11:31:12 +0000 (+0100) Subject: iio: adc: xilinx-ams: fix devm_krealloc() return value check X-Git-Tag: baikal/aarch64/sdk6.1~76 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=65966c298a5d8d1568523edbe8f0879a75ef3d24;p=kernel.git iio: adc: xilinx-ams: fix devm_krealloc() return value check 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 Acked-by: Michal Simek Link: https://lore.kernel.org/r/20221125113112.219290-1-marpagan@redhat.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c index 5b4bdf3a26bb8..a507d2e170792 100644 --- a/drivers/iio/adc/xilinx-ams.c +++ b/drivers/iio/adc/xilinx-ams.c @@ -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;