From patchwork Thu Oct 8 05:34:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 7349061 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 77ECFBEEA4 for ; Thu, 8 Oct 2015 05:36:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9048F2058C for ; Thu, 8 Oct 2015 05:36:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A0A0E2056C for ; Thu, 8 Oct 2015 05:36:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751640AbbJHFfJ (ORCPT ); Thu, 8 Oct 2015 01:35:09 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:34098 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750967AbbJHFfI (ORCPT ); Thu, 8 Oct 2015 01:35:08 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NVV004H4ZIHSV70@mailout4.w1.samsung.com>; Thu, 08 Oct 2015 06:35:05 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-0d-56160088b9de Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 27.AD.05269.88006165; Thu, 8 Oct 2015 06:35:04 +0100 (BST) Received: from localhost.localdomain ([10.252.80.64]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NVV001ENZIA2J60@eusync4.samsung.com>; Thu, 08 Oct 2015 06:35:04 +0100 (BST) From: Krzysztof Kozlowski To: Lukasz Majewski , Zhang Rui , Eduardo Valentin , Kukjin Kim , Krzysztof Kozlowski , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org Subject: [PATCH 1/5] thermal: exynos: Fix unbalanced regulator disable on probe failure Date: Thu, 08 Oct 2015 14:34:02 +0900 Message-id: <1444282446-6419-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4Nd0OBrEwg7n7DS3mX7nGavH6haFF /+PXzBZvHm5mtNj0GCh0edccNovPvUcYLWac38dk8eRhH5vFgo2PGB24PHbOusvusXjPSyaP Tas62Tw2L6n36NuyitHj8ya5ALYoLpuU1JzMstQifbsEroze7ZOZCiYLV8w5uoe9gfEKfxcj J4eEgInEvlVH2SFsMYkL99azdTFycQgJLGWUOPmxlwXC+c8o8fjteRaQKjYBY4nNy5eAVYkI nGGSONmxlREkwSwgJbHu0yE2EFtYIFLi0MGbYA0sAqoS19tvMIPYvAJuEh37ZkGtk5M4eWwy 6wRG7gWMDKsYRVNLkwuKk9JzjfSKE3OLS/PS9ZLzczcxQoLp6w7GpcesDjEKcDAq8fD+MBYJ E2JNLCuuzD3EKMHBrCTCu3O+aJgQb0piZVVqUX58UWlOavEhRmkOFiVx3pm73ocICaQnlqRm p6YWpBbBZJk4OKUaGL3dmHibfh/Ljmc7+lXkKKPdsUTRzxNb728UC+4Nj7LI+fM04mphyf63 eRz/s5JSXu/MnFSzPYVNyyTwxCmLY2uYlskyL+U8bnt5y4ZXJ59uPikxK6/5uaOUyf2WfPFt XwWKw6b3K95Z1sr7rLD9BqdsqG9u3ZMpTy1VCicaq65607tsyVVLDSWW4oxEQy3mouJEAND0 vRciAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Krzysztof Kozlowski Fixes: 5f09a5cbd14a ("thermal: exynos: Disable the regulator on probe failure") Cc: Reviewed-by: Alim Akhtar Acked-by: Lukasz Majewski Tested-by: Lukasz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 34 +++++++++++++++++----------------- 1 file 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) struct exynos_tmu_data *data = platform_get_drvdata(pdev); struct exynos_tmu_platform_data *pdata; struct resource res; - int ret; if (!data || !pdev->dev.of_node) return -ENODEV; - /* - * Try enabling the regulator if found - * TODO: Add regulator as an SOC feature, so that regulator enable - * is a compulsory call. - */ - data->regulator = devm_regulator_get(&pdev->dev, "vtmu"); - if (!IS_ERR(data->regulator)) { - ret = regulator_enable(data->regulator); - if (ret) { - dev_err(&pdev->dev, "failed to enable vtmu\n"); - return ret; - } - } else { - dev_info(&pdev->dev, "Regulator node (vtmu) not found\n"); - } - data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl"); if (data->id < 0) data->id = 0; @@ -1312,6 +1295,23 @@ static int exynos_tmu_probe(struct platform_device *pdev) pr_err("thermal: tz: %p ERROR\n", data->tzd); return PTR_ERR(data->tzd); } + + /* + * Try enabling the regulator if found + * TODO: Add regulator as an SOC feature, so that regulator enable + * is a compulsory call. + */ + data->regulator = devm_regulator_get(&pdev->dev, "vtmu"); + if (!IS_ERR(data->regulator)) { + ret = regulator_enable(data->regulator); + if (ret) { + dev_err(&pdev->dev, "failed to enable vtmu\n"); + return ret; + } + } else { + dev_info(&pdev->dev, "Regulator node (vtmu) not found\n"); + } + ret = exynos_map_dt_data(pdev); if (ret) goto err_sensor;