public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [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

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