aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2015-10-08 01:34:02 -0400
committerEduardo Valentin <edubezval@gmail.com>2015-11-04 14:07:51 -0500
commit824ead03b78403a21449cb7eb153a4344cd3b4c8 (patch)
treed4228adfb49a3effde603f081d9d56078d08a47e
parentce5ee1611284bef81d0308c6c2749902f55ed1d5 (diff)
thermal: exynos: Fix unbalanced regulator disable on probe failure
During probe if the regulator could not be enabled, the error exit path would still disable it. This could lead to unbalanced counter of regulator enable/disable. The patch moves code for getting and enabling the regulator from exynos_map_dt_data() to probe function because it is really not a part of getting Device Tree properties. Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Fixes: 5f09a5cbd14a ("thermal: exynos: Disable the regulator on probe failure") Cc: <stable@vger.kernel.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
-rw-r--r--drivers/thermal/samsung/exynos_tmu.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 0bae8cc6c23a..23f4320f8ef7 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -1168,27 +1168,10 @@ static int exynos_map_dt_data(struct platform_device *pdev)
1168 struct exynos_tmu_data *data = platform_get_drvdata(pdev); 1168 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
1169 struct exynos_tmu_platform_data *pdata; 1169 struct exynos_tmu_platform_data *pdata;
1170 struct resource res; 1170 struct resource res;
1171 int ret;
1172 1171
1173 if (!data || !pdev->dev.of_node) 1172 if (!data || !pdev->dev.of_node)
1174 return -ENODEV; 1173 return -ENODEV;
1175 1174
1176 /*
1177 * Try enabling the regulator if found
1178 * TODO: Add regulator as an SOC feature, so that regulator enable
1179 * is a compulsory call.
1180 */
1181 data->regulator = devm_regulator_get(&pdev->dev, "vtmu");
1182 if (!IS_ERR(data->regulator)) {
1183 ret = regulator_enable(data->regulator);
1184 if (ret) {
1185 dev_err(&pdev->dev, "failed to enable vtmu\n");
1186 return ret;
1187 }
1188 } else {
1189 dev_info(&pdev->dev, "Regulator node (vtmu) not found\n");
1190 }
1191
1192 data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl"); 1175 data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl");
1193 if (data->id < 0) 1176 if (data->id < 0)
1194 data->id = 0; 1177 data->id = 0;
@@ -1312,6 +1295,23 @@ static int exynos_tmu_probe(struct platform_device *pdev)
1312 pr_err("thermal: tz: %p ERROR\n", data->tzd); 1295 pr_err("thermal: tz: %p ERROR\n", data->tzd);
1313 return PTR_ERR(data->tzd); 1296 return PTR_ERR(data->tzd);
1314 } 1297 }
1298
1299 /*
1300 * Try enabling the regulator if found
1301 * TODO: Add regulator as an SOC feature, so that regulator enable
1302 * is a compulsory call.
1303 */
1304 data->regulator = devm_regulator_get(&pdev->dev, "vtmu");
1305 if (!IS_ERR(data->regulator)) {
1306 ret = regulator_enable(data->regulator);
1307 if (ret) {
1308 dev_err(&pdev->dev, "failed to enable vtmu\n");
1309 return ret;
1310 }
1311 } else {
1312 dev_info(&pdev->dev, "Regulator node (vtmu) not found\n");
1313 }
1314
1315 ret = exynos_map_dt_data(pdev); 1315 ret = exynos_map_dt_data(pdev);
1316 if (ret) 1316 if (ret)
1317 goto err_sensor; 1317 goto err_sensor;