From patchwork Thu May 30 13:51:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Vaussard X-Patchwork-Id: 2636901 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 4C247DF2A1 for ; Thu, 30 May 2013 14:29:06 +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 1Ui3KF-0000PD-Eq; Thu, 30 May 2013 13:55:35 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ui3I1-0000B5-3T; Thu, 30 May 2013 13:53:13 +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 1Ui3Hc-00007Z-Cr for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2013 13:52:50 +0000 Received: (qmail 1074 invoked by uid 107); 30 May 2013 13:52: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; Thu, 30 May 2013 15:52:24 +0200 From: Florian Vaussard To: Grant Likely , Rob Herring , Samuel Ortiz Subject: [PATCH 3/3] mfd: twl4030-power: Simplify error path Date: Thu, 30 May 2013 15:51:56 +0200 Message-Id: <1369921916-7435-4-git-send-email-florian.vaussard@epfl.ch> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1369921916-7435-1-git-send-email-florian.vaussard@epfl.ch> References: <1369921916-7435-1-git-send-email-florian.vaussard@epfl.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130530_095249_190348_F094FA1D X-CRM114-Status: UNSURE ( 9.67 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -3.0 (---) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-3.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Tero Kristo , 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 Remove unnecessary goto statements, causing duplicated if conditions. Signed-off-by: Florian Vaussard --- drivers/mfd/twl4030-power.c | 37 ++++++++++++++----------------------- 1 files changed, 14 insertions(+), 23 deletions(-) diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index d12d748..7eed526 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c @@ -567,21 +567,25 @@ int twl4030_power_probe(struct platform_device *pdev) err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1, TWL4030_PM_MASTER_PROTECT_KEY); - if (err) - goto unlock; - - err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG2, + err |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG2, TWL4030_PM_MASTER_PROTECT_KEY); - if (err) - goto unlock; + + if (err) { + pr_err("TWL4030 Unable to unlock registers\n"); + return err; + } if (pdata) { err = twl4030_power_configure_scripts(pdata); - if (err) - goto load; + if (err) { + pr_err("TWL4030 failed to load scripts\n"); + return err; + } err = twl4030_power_configure_resources(pdata); - if (err) - goto resource; + if (err) { + pr_err("TWL4030 failed to configure resource\n"); + return err; + } } /* Board has to be wired properly to use this feature */ @@ -611,19 +615,6 @@ relock: if (err) pr_err("TWL4030 Unable to relock registers\n"); return err; - -unlock: - if (err) - pr_err("TWL4030 Unable to unlock registers\n"); - return err; -load: - if (err) - pr_err("TWL4030 failed to load scripts\n"); - return err; -resource: - if (err) - pr_err("TWL4030 failed to configure resource\n"); - return err; } static int twl4030_power_remove(struct platform_device *pdev)