thermal/drivers/sun8i: Fix some error handling paths in sun8i_ths_probe()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 14 May 2023 18:46:05 +0000 (20:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jul 2023 14:21:01 +0000 (16:21 +0200)
commit5d56a8d670a57402b244b8e70373a9fa6080f333
treee3833a515c182d111b5a6c0ce7e18fc4ee84d39f
parent2b7e2251c434477bdf195ae87aa944b413b4398d
thermal/drivers/sun8i: Fix some error handling paths in sun8i_ths_probe()

[ Upstream commit 89382022b370dfd34eaae9c863baa123fcd4d132 ]

Should an error occur after calling sun8i_ths_resource_init() in the probe
function, some resources need to be released, as already done in the
.remove() function.

Switch to the devm_clk_get_enabled() helper and add a new devm_action to
turn sun8i_ths_resource_init() into a fully managed function.

Move the place where reset_control_deassert() is called so that the
recommended order of reset release/clock enable steps is kept.
A64 manual states that:

3.3.6.4. Gating and reset

Make sure that the reset signal has been released before the release of
module clock gating;

This fixes the issue and removes some LoC at the same time.

Fixes: dccc5c3b6f30 ("thermal/drivers/sun8i: Add thermal driver for H6/H5/H3/A64/A83T/R40")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/a8ae84bd2dc4b55fe428f8e20f31438bf8bb6762.1684089931.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/thermal/sun8i_thermal.c