From: Krzysztof Kozlowski Date: Mon, 8 Jun 2015 01:35:49 +0000 (+0900) Subject: thermal: exynos: Disable the regulator on probe failure X-Git-Tag: v4.1.6~8 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=00d707ae64f062c2c4b488c76306278a1298557a;p=users%2Fjedix%2Flinux-maple.git thermal: exynos: Disable the regulator on probe failure commit 5f09a5cbd14ae16e93866040fa44d930ff885650 upstream. During probe the regulator (if present) was enabled but not disabled in case of failure. So an unsuccessful probe lead to enabling the regulator which was actually not needed because the device was not enabled. Additionally each deferred probe lead to increase of regulator enable count so it would not be effectively disabled during removal of the device. Test HW: Exynos4412 - Trats2 board Signed-off-by: Krzysztof Kozlowski Fixes: 498d22f616f6 ("thermal: exynos: Support for TMU regulator defined at device tree") Reviewed-by: Javier Martinez Canillas Signed-off-by: Lukasz Majewski Tested-by: Lukasz Majewski Signed-off-by: Eduardo Valentin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 1d30b09756515..67098a8a7a021 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1209,6 +1209,8 @@ err_clk_sec: if (!IS_ERR(data->clk_sec)) clk_unprepare(data->clk_sec); err_sensor: + if (!IS_ERR_OR_NULL(data->regulator)) + regulator_disable(data->regulator); thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); return ret;