iio: adc: xilinx-ams: fix devm_krealloc() return value check
Subsystems (3)
PATCH 1/1 iio: adc: xilinx-ams: fix devm_krealloc() return value check
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.
--- drivers/iio/adc/xilinx-ams.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/xilinx-ams.c +1 -1
@@ -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;
Signature · 1 line
2.38.1
Quoted 29 lines · Marco Pagani
CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
The clang-analyzer reported a warning: "Value stored to 'ret' is never read".
Fix the return value check if
devm_krealloc()fails to resizeams_channels.Fixes d5c70627a794 ("iio: adc: Add Xilinx AMS driver")Signed-off-by Marco Pagani <[email protected]>--- drivers/iio/adc/xilinx-ams.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/adc/xilinx-ams.c +1
-2@@ -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; --
Quoted 2 lines
2.38.1
Thanks,
Michal
Quoted 27 lines · On Wed, 30 Nov 2022 18:04:26 +0100 Michal Simek <[email protected]> wrote:
Quoted 26 lines · Marco Pagani
CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
The clang-analyzer reported a warning: "Value stored to 'ret' is never read".
Fix the return value check if
devm_krealloc()fails to resizeams_channels.Fixes d5c70627a794 ("iio: adc: Add Xilinx AMS driver")Signed-off-by Marco Pagani <[email protected]>--- drivers/iio/adc/xilinx-ams.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/adc/xilinx-ams.c +1
-1@@ -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 ;
Quoted 7 lines
Quoted 5 lines
drivers/iio/adc/xilinx-ams.c +0
-1indio_dev->channels = dev_channels; indio_dev->num_channels = num_channels; --2.38.1
Acked-by Michal Simek <[email protected]>
Applied to the fixes-togreg branch of iio.git. Given merge window opening soon it might be a few weeks before this goes upstream.
Thanks,
Jonathan
Quoted 3 lines
Thanks,
Michal