[PATCH] thermal/drivers/mediatek/lvts_thermal: only update registered thermal zones

Daniel Lezcano daniel.lezcano at linaro.org
Fri Apr 7 02:22:26 PDT 2023


On 07/04/2023 10:45, Chen-Yu Tsai wrote:
> On Sun, Apr 2, 2023 at 4:34 AM Daniel Lezcano <daniel.lezcano at linaro.org> wrote:
>>
>> On 28/03/2023 05:10, Chen-Yu Tsai wrote:
>>> It's possible for some sensors or thermal zones to not be registered,
>>> either because they are unused or not fully declared in the device tree.
>>> Nevertheless the driver enables interrupts for all sensors. If an
>>> interrupt happens for an not-registered sensor, the driver would end up
>>> updating a non-existent thermal zone, which leads to a NULL pointer
>>> dereference.
>>>
>>> Change it so that only registered thermal zones get updated.
>>
>> Why not change the interrupt initialization ?
> 
> I'll send another patch for that.
> 
> However I think the part in this patch should still be fixed?

If you are receiving an unexpected interrupt, there is something wrong 
with the initialization. If only the monitored thermal zones have their 
interrupt enabled, then you should never enter in the interrupt handler 
for a thermal zone which is not monitored, or did I miss something ?

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog




More information about the Linux-mediatek mailing list