From patchwork Mon Jun 8 01:35:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 6562681 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DF86A9F3D1 for ; Mon, 8 Jun 2015 01:36:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0CF6B204E1 for ; Mon, 8 Jun 2015 01:36:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 18D3A204D2 for ; Mon, 8 Jun 2015 01:36:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751511AbbFHBgK (ORCPT ); Sun, 7 Jun 2015 21:36:10 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:27622 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750872AbbFHBgI (ORCPT ); Sun, 7 Jun 2015 21:36:08 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NPL005PQR45QR00@mailout4.w1.samsung.com>; Mon, 08 Jun 2015 02:36:05 +0100 (BST) X-AuditID: cbfec7f4-f79c56d0000012ee-49-5574f184561d Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id E7.1D.04846.481F4755; Mon, 8 Jun 2015 02:36:05 +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 <0NPL00J08R3XG130@eusync4.samsung.com>; Mon, 08 Jun 2015 02:36: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] thermal: exynos: Disable the regulator on probe failure Date: Mon, 08 Jun 2015 10:35:49 +0900 Message-id: <1433727349-23330-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Nd3WjyWhBivyLOZfucZq8fqFoUX/ 49fMFm8ebma02PQYKHR51xw2i8+9RxgtZpzfx2Tx5GEfm8WCjY8YHbg8ds66y+6xeM9LJo9N qzrZPDYvqffo27KK0ePzJrkAtigum5TUnMyy1CJ9uwSujMa1p5gLWrkr5lxbz9bAuJyzi5GD Q0LAROLoO+EuRk4gU0ziwr31bF2MXBxCAksZJWZOWMEO4fxnlDg3bQsTSBWbgLHE5uVLwKpE BM4wSZzs2MoIkmAWkJJY9+kQG4gtLOAhsf/1GTCbRUBVYunBB+wgNq+Au8SG3TfZIdbJSZw8 Npl1AiP3AkaGVYyiqaXJBcVJ6bmGesWJucWleel6yfm5mxghgfRlB+PiY1aHGAU4GJV4eA8s KgkVYk0sK67MPcQowcGsJMJ79z5QiDclsbIqtSg/vqg0J7X4EKM0B4uSOO/cXe9DhATSE0tS s1NTC1KLYLJMHJxSDYzzezkXsdhMDFLiFCnRd1n4UGXrvwn8LwUnmkzMeSm84MmCpx18M52c kxw8uA7np0l4Fh1sDy1Lm90xYV7E8/dnT0lLSyiHPM6I3r1hosVXE/830xas+DNf5U3urLP/ brqrPN5wZpvfmwN+Gzl+25VPaHhc+T1KYtas1RJWdvp7626U+DP/fZSuxFKckWioxVxUnAgA bdaCWCACAAA= 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 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. Signed-off-by: Krzysztof Kozlowski Fixes: 498d22f616f6 ("thermal: exynos: Support for TMU regulator defined at device tree") Cc: Reviewed-by: Javier Martinez Canillas Acked-by: Lukasz Majewski --- I am not entirely convinced that this should go to stable. Leaving a regulator enabled in case of probe failure (no exynos TMU device) or after deferred probe (regulator won't be disabled during device removal) is not a critical issue, just leaks power. --- drivers/thermal/samsung/exynos_tmu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 531f4b179871..13c3aceed19d 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1392,6 +1392,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;