[PATCH] iio: accel: bmc150: free irq before teardown
From: Melbin K Mathew
Date: Sun Jul 05 2026 - 00:27:51 EST
bmc150_accel_core_probe() requests the interrupt with
devm_request_threaded_irq(). The managed IRQ is released only after the
driver remove callback has returned unless it is freed explicitly.
bmc150_accel_core_remove() currently unregisters the IIO device and
triggers, cleans up the triggered buffer, suspends the chip and disables
the regulators while the IRQ action is still registered. A late
interrupt can therefore run the hard or threaded handler while the IIO
trigger state is being torn down or after the device has been put into
deep suspend.
Free the IRQ at the start of remove so that no handler is running while
the rest of the driver state and hardware resources are dismantled.
Fixes: 55637c38377a ("iio: bmc150: Split the driver into core and i2c")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Melbin K Mathew <mlbnkm1@xxxxxxxxx>
---
drivers/iio/accel/bmc150-accel-core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
index 2398eb7e12cd..2adddc965650 100644
--- a/drivers/iio/accel/bmc150-accel-core.c
+++ b/drivers/iio/accel/bmc150-accel-core.c
@@ -1766,6 +1766,9 @@ void bmc150_accel_core_remove(struct device *dev)
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct bmc150_accel_data *data = iio_priv(indio_dev);
+ if (data->irq > 0)
+ devm_free_irq(dev, data->irq, indio_dev);
+
iio_device_unregister(indio_dev);
pm_runtime_disable(dev);
--
2.39.5