public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: xilinx-ams: fix devm_krealloc() return value check
@ 2022-11-25 11:31 Marco Pagani
  2022-11-30 17:04 ` Michal Simek
  0 siblings, 1 reply; 3+ messages in thread
From: Marco Pagani @ 2022-11-25 11:31 UTC (permalink / raw)
  To: Anand Ashok Dumbre, Jonathan Cameron, Lars-Peter Clausen,
	Michal Simek, Nathan Chancellor, Nick Desaulniers, Tom Rix,
	Manish Narani
  Cc: Marco Pagani, Jonathan Cameron, linux-iio, linux-arm-kernel,
	linux-kernel, llvm

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: d5c70627a794 ("iio: adc: Add Xilinx AMS driver")
Signed-off-by: Marco Pagani <marpagan@redhat.com>
---
 drivers/iio/adc/xilinx-ams.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
index 5b4bdf3a26bb..a507d2e17079 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;
-- 
2.38.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: xilinx-ams: fix devm_krealloc() return value check
  2022-11-25 11:31 [PATCH] iio: adc: xilinx-ams: fix devm_krealloc() return value check Marco Pagani
@ 2022-11-30 17:04 ` Michal Simek
  2022-12-04 14:36   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Simek @ 2022-11-30 17:04 UTC (permalink / raw)
  To: Marco Pagani, Anand Ashok Dumbre, Jonathan Cameron,
	Lars-Peter Clausen, Michal Simek, Nathan Chancellor,
	Nick Desaulniers, Tom Rix, Manish Narani
  Cc: Jonathan Cameron, linux-iio, linux-arm-kernel, linux-kernel, llvm



On 11/25/22 12:31, Marco Pagani wrote:
> 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 resize
> ams_channels.
> 
> Fixes: d5c70627a794 ("iio: adc: Add Xilinx AMS driver")
> Signed-off-by: Marco Pagani <marpagan@redhat.com>
> ---
>   drivers/iio/adc/xilinx-ams.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
> index 5b4bdf3a26bb..a507d2e17079 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;
> --
> 2.38.1
> 

Acked-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: xilinx-ams: fix devm_krealloc() return value check
  2022-11-30 17:04 ` Michal Simek
@ 2022-12-04 14:36   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2022-12-04 14:36 UTC (permalink / raw)
  To: Michal Simek
  Cc: Marco Pagani, Anand Ashok Dumbre, Lars-Peter Clausen,
	Michal Simek, Nathan Chancellor, Nick Desaulniers, Tom Rix,
	Manish Narani, Jonathan Cameron, linux-iio, linux-arm-kernel,
	linux-kernel, llvm

On Wed, 30 Nov 2022 18:04:26 +0100
Michal Simek <michal.simek@amd.com> wrote:

> On 11/25/22 12:31, Marco Pagani wrote:
> > 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 resize
> > ams_channels.
> > 
> > Fixes: d5c70627a794 ("iio: adc: Add Xilinx AMS driver")
> > Signed-off-by: Marco Pagani <marpagan@redhat.com>
> > ---
> >   drivers/iio/adc/xilinx-ams.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
> > index 5b4bdf3a26bb..a507d2e17079 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;
> > --
> > 2.38.1
> >   
> 
> Acked-by: Michal Simek <michal.simek@amd.com>

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

> 
> Thanks,
> Michal


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-04 18:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-25 11:31 [PATCH] iio: adc: xilinx-ams: fix devm_krealloc() return value check Marco Pagani
2022-11-30 17:04 ` Michal Simek
2022-12-04 14:36   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox