From patchwork Tue Jun 18 13:18:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Vaussard X-Patchwork-Id: 2742471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2F569C0AB1 for ; Tue, 18 Jun 2013 13:20:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 075202044E for ; Tue, 18 Jun 2013 13:20:51 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B135520445 for ; Tue, 18 Jun 2013 13:20:49 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uovom-0004aw-EY; Tue, 18 Jun 2013 13:19:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UovoW-0000Hw-PQ; Tue, 18 Jun 2013 13:19:12 +0000 Received: from slb-mail4.epfl.ch ([2001:620:618:1e0:1:80b2:e059:1] helo=smtp4.epfl.ch) by merlin.infradead.org with smtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uovo4-0000D3-3N for linux-arm-kernel@lists.infradead.org; Tue, 18 Jun 2013 13:18:47 +0000 Received: (qmail 30441 invoked by uid 107); 18 Jun 2013 13:18:24 -0000 X-Virus-Scanned: ClamAV Received: from lsro1pc340.epfl.ch (HELO lsro1pc340.epfl.ch) (128.178.145.154) (authenticated) by smtp4.epfl.ch (AngelmatoPhylax SMTP proxy) with ESMTPA; Tue, 18 Jun 2013 15:18:24 +0200 From: Florian Vaussard To: Grant Likely , Rob Herring , Samuel Ortiz Subject: [PATCH v2 5/5] mfd: twl4030-power: Fix relocking on error Date: Tue, 18 Jun 2013 15:18:00 +0200 Message-Id: <1371561480-28325-6-git-send-email-florian.vaussard@epfl.ch> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1371561480-28325-1-git-send-email-florian.vaussard@epfl.ch> References: <1371561480-28325-1-git-send-email-florian.vaussard@epfl.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130618_091845_012918_0A29FEAF X-CRM114-Status: GOOD ( 10.50 ) X-Spam-Score: -3.1 (---) Cc: Tero Kristo , Kevin Hilman , linux-doc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, Mark Brown , linux-kernel@vger.kernel.org, Peter Ujfalusi , Florian Vaussard , Rob Landley , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=-5.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 If an error occurs when loading power scripts or resources, the registers are not correctly relocked. Fix it. Signed-off-by: Florian Vaussard --- drivers/mfd/twl4030-power.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index 1c19d82..a8b33c9 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c @@ -558,6 +558,7 @@ int twl4030_power_probe(struct platform_device *pdev) struct twl4030_power_data *pdata = pdev->dev.platform_data; struct device_node *node = pdev->dev.of_node; int err = 0; + int err2 = 0; u8 val; if (!pdata && !node) { @@ -581,12 +582,12 @@ int twl4030_power_probe(struct platform_device *pdev) err = twl4030_power_configure_scripts(pdata); if (err) { pr_err("TWL4030 failed to load scripts\n"); - return err; + goto relock; } err = twl4030_power_configure_resources(pdata); if (err) { pr_err("TWL4030 failed to configure resource\n"); - return err; + goto relock; } } @@ -612,10 +613,13 @@ int twl4030_power_probe(struct platform_device *pdev) } relock: - err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0, + err2 = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0, TWL4030_PM_MASTER_PROTECT_KEY); - if (err) + if (err2) { pr_err("TWL4030 Unable to relock registers\n"); + return err2; + } + return err; }