OpenCloudOS-Kernel/drivers/thermal/broadcom
Krzysztof Kozlowski 34e788045d thermal/drivers/broadcom: Fix race between removal and clock disable
[ Upstream commit e90c369cc2ffcf7145a46448de101f715a1f5584 ]

During the probe, driver enables clocks necessary to access registers
(in get_temp()) and then registers thermal zone with managed-resources
(devm) interface.  Removal of device is not done in reversed order,
because:
1. Clock will be disabled in driver remove() callback - thermal zone is
   still registered and accessible to users,
2. devm interface will unregister thermal zone.

This leaves short window between (1) and (2) for accessing the
get_temp() callback with disabled clock.

Fix this by enabling clock also via devm-interface, so entire cleanup
path will be in proper, reversed order.

Fixes: 8454c8c09c ("thermal/drivers/bcm2835: Remove buggy call to thermal_of_zone_unregister")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240709-thermal-probe-v1-1-241644e2b6e0@linaro.org
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-11 12:47:12 +02:00
..
Kconfig thermal: Add BCM2711 thermal driver 2020-01-27 11:41:08 +01:00
Makefile thermal: Add BCM2711 thermal driver 2020-01-27 11:41:08 +01:00
bcm2711_thermal.c thermal: Explicitly include correct DT includes 2023-07-31 20:03:42 +02:00
bcm2835_thermal.c thermal/drivers/broadcom: Fix race between removal and clock disable 2024-08-11 12:47:12 +02:00
brcmstb_thermal.c thermal/drivers/broadcom/brcstb_thermal: Removed unneeded platform_set_drvdata() 2023-08-16 12:22:28 +02:00
ns-thermal.c thermal/core: Use the thermal zone 'devdata' accessor in thermal located drivers 2023-03-03 20:45:02 +01:00
sr-thermal.c thermal/drivers/broadcom/sr-thermal: Removed call to platform_set_drvdata() 2023-08-16 12:17:19 +02:00