Skip to content
/ linux Public

Commit 597d749

Browse files
harshimogalapalliSasha Levin
authored andcommitted
iio: sca3000: Fix a resource leak in sca3000_probe()
[ Upstream commit 62b44eb ] 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: 9a4936d ("staging:iio:accel:sca3000 Tidy up probe order to avoid a race.") Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 760ebd5 commit 597d749

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/iio/accel/sca3000.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,11 @@ static int sca3000_probe(struct spi_device *spi)
14961496
if (ret)
14971497
goto error_free_irq;
14981498

1499-
return iio_device_register(indio_dev);
1499+
ret = iio_device_register(indio_dev);
1500+
if (ret)
1501+
goto error_free_irq;
1502+
1503+
return 0;
15001504

15011505
error_free_irq:
15021506
if (spi->irq)

0 commit comments

Comments
 (0)