Re: [PATCH] thermal/drivers/armada: free the overheat IRQ before the zones are gone

From: Miquel Raynal

Date: Wed Nov 18 2026 - 04:30:03 EST


On 18/11/2026 at 15:23:39 +08, Yaohan Li <shunsheng1218@xxxxxxxxx> wrote:

> The overheat interrupt is requested before the thermal zones are
> registered, so devres releases the zones first and the interrupt
> afterwards. armada_overheat_isr_thread() calls
> thermal_zone_device_update() on priv->overheat_sensor, which by then has
> been unregistered and freed, and thermal_zone_device_update() locks the
> zone mutex unconditionally.
>
> The handler also polls the sensor once per second until the temperature
> drops below the threshold. If that poll is still running when the
> device goes away, free_irq() waits for it and the removal is blocked for
> as long as the sensor stays hot.
>
> The same handler runs while priv->overheat_sensor is still NULL, because
> the interrupt is requested before the zones exist and a spurious
> interrupt in that window passes a NULL zone to
> thermal_zone_device_update().
>
> Move the teardown into armada_thermal_quiesce_irq(), which disables the
> interrupt, frees it and tells the poll loop to give up, and call it from
> ->remove(). The same helper is called from the probe rollback once the
> interrupt has been requested: the driver core does not run ->remove()
> for a probe that fails, while devres still frees the zones and the
> private data of an interface whose handler is registered.
>
> Read the zone once at the top of the thread and bail out when it is not
> published yet or the driver is shutting down, and reuse that pointer for
> both thermal_zone_device_update() calls.
>
> Fixes: 879d7362d1d0 ("thermal: armada: add overheat interrupt support")
> Signed-off-by: Yaohan Li <shunsheng1218@xxxxxxxxx>

Your solution is over-engineered. For a case simple like that, you would
need to just move the IRQ registration (not the get_irq()) after the
zones registration.

Maybe you need a shutdown boolean as well, but clearly not all the extra
complexity you are trying to add.

Thanks,
Miquèl