Re: [PATCH v3] thermal/drivers/rcar_thermal: disable the work before masking the interrupt
From: Yaohan Li
Date: Tue Nov 24 2026 - 22:03:33 EST
Hi Niklas,
Thanks for reviewing this.
The devm_free_irq() calls are intended to protect the lifetime of the
sensor objects, rather than only to wait for an in-flight handler.
The driver requests its shared IRQs before allocating the individual
sensor priv objects. Because devres releases resources in reverse
order, those objects can be freed before the managed IRQ handlers are
released.
Even after the thermal interrupt sources are masked, another device
sharing the IRQ line can trigger rcar_thermal_irq(). The handler still
walks common->head and calls rcar_thermal_had_changed() for each sensor,
even when the masked status is zero.
Therefore, synchronize_irq() would wait for the current handler, but
would not prevent a later invocation from accessing the freed sensor
objects.
devm_free_irq() removes this driver's handler before the sensor objects
can be freed, while leaving other users of the shared IRQ intact.
I agree that the commit message should distinguish this lifetime issue
from the delayed-work race more clearly.
Thanks,
Yaohan