Commit 62b44ebc authored by Harshit Mogalapalli's avatar Harshit Mogalapalli Committed by Jonathan Cameron
Browse files

iio: sca3000: Fix a resource leak in sca3000_probe()



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: 9a4936dc ("staging:iio:accel:sca3000 Tidy up probe order to avoid a race.")
Signed-off-by: default avatarHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent dc81be96
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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)