Re: [PATCH] iio: accel: bmc150: free irq before teardown

From: Andy Shevchenko

Date: Sun Jul 05 2026 - 02:54:21 EST


On Sun, Jul 05, 2026 at 06:27:31AM +0200, Melbin K Mathew wrote:
> 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.

In general this is correct fix, but have you checked the rest of remove if it
has any communication with HW and if that communication relies on IRQ to be on?

(*yes, this is very unlikely, but please double check as rarely we have some HW
that might need that, and in such a case the fix might be different)

Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>

--
With Best Regards,
Andy Shevchenko