Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: accel: bmc150: free irq before teardown
@ 2026-07-05  4:27 Melbin K Mathew
  2026-07-05  6:53 ` Andy Shevchenko
  2026-07-05 23:02 ` Jonathan Cameron
  0 siblings, 2 replies; 5+ messages in thread
From: Melbin K Mathew @ 2026-07-05  4:27 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: linux-kernel, David Lechner, Nuno Sá, Andy Shevchenko,
	Melbin K Mathew, stable

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@vger.kernel.org
Signed-off-by: Melbin K Mathew <mlbnkm1@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-06  6:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-05  4:27 [PATCH] iio: accel: bmc150: free irq before teardown Melbin K Mathew
2026-07-05  6:53 ` Andy Shevchenko
2026-07-05  7:33   ` Melbin K Mathew
2026-07-05 23:02 ` Jonathan Cameron
2026-07-06  6:11   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox