* [PATCH] iio: sca3000: Fix a resource leak in sca3000_probe()
@ 2026-01-28 6:49 Harshit Mogalapalli
2026-01-28 7:15 ` Harshit Mogalapalli
2026-01-28 9:48 ` Andy Shevchenko
0 siblings, 2 replies; 5+ messages in thread
From: Harshit Mogalapalli @ 2026-01-28 6:49 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Harshit Mogalapalli, Gustavo Bastos, Andrew Ijano,
Lars-Peter Clausen, linux-iio, linux-kernel
Cc: dan.carpenter, kernel-janitors, error27
spi->irq from request_threaded_irq() not released when
iio_device_register() fails. Add an return value check and jump to a
common error handler when iio_device_register() fails.
Fixes: 9a4936dc89a3 ("staging:iio:accel:sca3000 Tidy up probe order to avoid a race.")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
drivers/iio/accel/sca3000.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
index bfa8a3f5a92f..9ef4d6e27466 100644
--- a/drivers/iio/accel/sca3000.c
+++ b/drivers/iio/accel/sca3000.c
@@ -1489,7 +1489,11 @@ static int sca3000_probe(struct spi_device *spi)
if (ret)
goto error_free_irq;
- return iio_device_register(indio_dev);
+ ret = iio_device_register(indio_dev);
+ if (ret)
+ goto error_free_irq;
+
+ return 0;
error_free_irq:
if (spi->irq)
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] iio: sca3000: Fix a resource leak in sca3000_probe()
2026-01-28 6:49 [PATCH] iio: sca3000: Fix a resource leak in sca3000_probe() Harshit Mogalapalli
@ 2026-01-28 7:15 ` Harshit Mogalapalli
2026-01-28 9:48 ` Andy Shevchenko
1 sibling, 0 replies; 5+ messages in thread
From: Harshit Mogalapalli @ 2026-01-28 7:15 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Gustavo Bastos, Andrew Ijano, Lars-Peter Clausen, linux-iio,
linux-kernel
Cc: dan.carpenter, kernel-janitors, error27
Hi,
On 28/01/26 12:19, Harshit Mogalapalli wrote:
> spi->irq from request_threaded_irq() not released when
> iio_device_register() fails. Add an return value check and jump to a
> common error handler when iio_device_register() fails.
>
> Fixes: 9a4936dc89a3 ("staging:iio:accel:sca3000 Tidy up probe order to avoid a race.")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
Missed informing about how it was found.
Only compile tested, found with smatch.
> drivers/iio/accel/sca3000.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
> index bfa8a3f5a92f..9ef4d6e27466 100644
> --- a/drivers/iio/accel/sca3000.c
> +++ b/drivers/iio/accel/sca3000.c
> @@ -1489,7 +1489,11 @@ static int sca3000_probe(struct spi_device *spi)
> if (ret)
> goto error_free_irq;
>
> - return iio_device_register(indio_dev);
> + ret = iio_device_register(indio_dev);
> + if (ret)
> + goto error_free_irq;
> +
> + return 0;
>
> error_free_irq:
> if (spi->irq)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] iio: sca3000: Fix a resource leak in sca3000_probe()
2026-01-28 6:49 [PATCH] iio: sca3000: Fix a resource leak in sca3000_probe() Harshit Mogalapalli
2026-01-28 7:15 ` Harshit Mogalapalli
@ 2026-01-28 9:48 ` Andy Shevchenko
2026-01-28 14:45 ` Harshit Mogalapalli
1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2026-01-28 9:48 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Gustavo Bastos, Andrew Ijano, Lars-Peter Clausen, linux-iio,
linux-kernel, dan.carpenter, kernel-janitors, error27
On Tue, Jan 27, 2026 at 10:49:49PM -0800, Harshit Mogalapalli wrote:
> spi->irq from request_threaded_irq() not released when
> iio_device_register() fails. Add an return value check and jump to a
> common error handler when iio_device_register() fails.
LGTM, but I would rather converting this to use managed resources.
So, if Jonathan wants to take this first,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: sca3000: Fix a resource leak in sca3000_probe()
2026-01-28 9:48 ` Andy Shevchenko
@ 2026-01-28 14:45 ` Harshit Mogalapalli
2026-01-29 18:24 ` Jonathan Cameron
0 siblings, 1 reply; 5+ messages in thread
From: Harshit Mogalapalli @ 2026-01-28 14:45 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Gustavo Bastos, Andrew Ijano, Lars-Peter Clausen, linux-iio,
linux-kernel, dan.carpenter, kernel-janitors, error27
Hi Andy,
On 28/01/26 15:18, Andy Shevchenko wrote:
> On Tue, Jan 27, 2026 at 10:49:49PM -0800, Harshit Mogalapalli wrote:
>> spi->irq from request_threaded_irq() not released when
>> iio_device_register() fails. Add an return value check and jump to a
>> common error handler when iio_device_register() fails.
>
> LGTM, but I would rather converting this to use managed resources.
>
Thanks for the review.
I’ll follow up with a separate patch that converts it to devm-based
resource handling. Maybe that helps in a way to keep the fix and
refactor separate ?
> So, if Jonathan wants to take this first,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
>
Thanks!
Regards,
Harshit
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: sca3000: Fix a resource leak in sca3000_probe()
2026-01-28 14:45 ` Harshit Mogalapalli
@ 2026-01-29 18:24 ` Jonathan Cameron
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2026-01-29 18:24 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: Andy Shevchenko, David Lechner, Nuno Sá, Andy Shevchenko,
Gustavo Bastos, Andrew Ijano, Lars-Peter Clausen, linux-iio,
linux-kernel, dan.carpenter, kernel-janitors, error27
On Wed, 28 Jan 2026 20:15:06 +0530
Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> wrote:
> Hi Andy,
>
> On 28/01/26 15:18, Andy Shevchenko wrote:
> > On Tue, Jan 27, 2026 at 10:49:49PM -0800, Harshit Mogalapalli wrote:
> >> spi->irq from request_threaded_irq() not released when
> >> iio_device_register() fails. Add an return value check and jump to a
> >> common error handler when iio_device_register() fails.
> >
> > LGTM, but I would rather converting this to use managed resources.
> >
>
> Thanks for the review.
>
> I’ll follow up with a separate patch that converts it to devm-based
> resource handling. Maybe that helps in a way to keep the fix and
> refactor separate ?
>
Yes.
> > So, if Jonathan wants to take this first,
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> >
Applied.
Not that often we get changes for this one. It was one of the
earliest IIO drivers. Anyhow, nothing wrong with modernising it
if you want to work on it!
Thanks,
Jonathan
>
> Thanks!
>
> Regards,
> Harshit
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-29 18:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-28 6:49 [PATCH] iio: sca3000: Fix a resource leak in sca3000_probe() Harshit Mogalapalli
2026-01-28 7:15 ` Harshit Mogalapalli
2026-01-28 9:48 ` Andy Shevchenko
2026-01-28 14:45 ` Harshit Mogalapalli
2026-01-29 18:24 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox