]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: sca3000: Fix a resource leak in sca3000_probe()
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Wed, 28 Jan 2026 06:49:49 +0000 (22:49 -0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 29 Jan 2026 18:22:53 +0000 (18:22 +0000)
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>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/sca3000.c

index 950b4c6724845a04abb0df555a078d6e77bca809..4a827be439a23eed50b33f513e49b7c002a9aef8 100644 (file)
@@ -1487,7 +1487,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)