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)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Mon, 26 Jun 2023 10:03:13 +0000 (12:03 +0200)
commit89382022b370dfd34eaae9c863baa123fcd4d132
tree72f256373aa32043f0c070c09895ae9e10d5ffeb
parent86edac7d3888c715fe3a81bd61f3617ecfe2e1dd
thermal/drivers/sun8i: Fix some error handling paths in sun8i_ths_probe()

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
drivers/thermal/sun8i_thermal.c