thermal/drivers/mediatek/lvts: Fix debugfs unregister on failure
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Wed, 2 Apr 2025 08:38:52 +0000 (10:38 +0200)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Fri, 16 May 2025 10:50:01 +0000 (12:50 +0200)
commitb49825661af93d9b8d7236f914803f136896f8fd
tree3a9672de8004af36e762c93fe0e38ac003f7d70c
parent0f2bd5a049ce80aa240c6b5beee2f8d9e5538c75
thermal/drivers/mediatek/lvts: Fix debugfs unregister on failure

When running the probe function for this driver, the function
lvts_debugfs_init() gets called in lvts_domain_init() which, in
turn, gets called in lvts_probe() before registering threaded
interrupt handlers.

Even though it's unlikely, the last call may fail and, if it does,
there's nothing removing the already created debugfs folder and
files.

In order to fix that, instead of calling the lvts debugfs cleanup
function upon failure, register a devm action that will take care
of calling that upon failure or driver removal.

Since devm was used, also delete the call to lvts_debugfs_exit()
in the lvts_remove() callback, as now that's done automatically.

Fixes: f5f633b18234 ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Link: https://lore.kernel.org/r/20250402083852.20624-1-angelogioacchino.delregno@collabora.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/thermal/mediatek/lvts_thermal.c