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: 6562711 Return-Path: X-Original-To: patchwork-linux-arm@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 57C2E9F3D1 for ; Mon, 8 Jun 2015 01:39:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 782112050B for ; Mon, 8 Jun 2015 01:39:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8289820503 for ; Mon, 8 Jun 2015 01:39:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z1lzP-0002Pi-KP; Mon, 08 Jun 2015 01:36:35 +0000 Received: from mailout4.w1.samsung.com ([210.118.77.14]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z1lzL-0002Mx-VR for linux-arm-kernel@lists.infradead.org; Mon, 08 Jun 2015 01:36:32 +0000 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> for linux-arm-kernel@lists.infradead.org; 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 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150607_183632_167479_B795C164 X-CRM114-Status: UNSURE ( 8.66 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.0 (-----) Cc: stable@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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;