Re: [PATCH 06/10] thermal/drivers/rcar: Free IRQs before cancelling delayed work on remove
From: Yaohan Li
Date: Sat Dec 05 2026 - 00:38:38 EST
Hi Niklas, Lee,
Thanks for looping me in.
disable_delayed_work_sync() prevents further queuing of priv->work and
drains a running instance, but it does not unregister or synchronize
with rcar_thermal_irq().
Since the IRQ is shared, the handler can still be invoked by another
device even after this device's interrupt sources have been masked. It
still accesses common->base and walks common->head.
Also, devm_request_irq() runs before the per-sensor priv allocations, so
leaving IRQ teardown to devres can allow those objects to be freed while
the handler is still registered.
I therefore agree that the IRQs need to be explicitly released before
the sensor state is freed.
One small ordering detail in the current patch: an in-flight
rcar_thermal_work() can call rcar_thermal_irq_enable() between the first
rcar_thermal_irq_disable() and cancel_delayed_work_sync(), which can
leave a brief window after devm_free_irq() where the hardware interrupt
source is re-enabled until the second rcar_thermal_irq_disable(). I
don't have R-Car Gen2 hardware to check whether that matters in
practice, so I won't send a competing revision while Lee's patch is
being reviewed.
Thanks,
Yaohan