From: florian.vaussard@epfl.ch (Florian Vaussard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] mfd: twl4030-power: Simplify error path
Date: Thu, 30 May 2013 15:51:56 +0200 [thread overview]
Message-ID: <1369921916-7435-4-git-send-email-florian.vaussard@epfl.ch> (raw)
In-Reply-To: <1369921916-7435-1-git-send-email-florian.vaussard@epfl.ch>
Remove unnecessary goto statements, causing duplicated if
conditions.
Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
---
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)
--
1.7.5.4
prev parent reply other threads:[~2013-05-30 13:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-30 13:51 [PATCH 0/3] mfd: twl4030-power: Start DT conversion Florian Vaussard
2013-05-30 13:51 ` [PATCH 1/3] mfd: twl4030-power: Split from twl-core into a dedicated module Florian Vaussard
2013-06-17 23:56 ` Samuel Ortiz
2013-06-18 8:53 ` Florian Vaussard
2013-05-30 13:51 ` [PATCH 2/3] mfd: twl4030-power: Start transition to DT Florian Vaussard
2013-06-18 0:02 ` Samuel Ortiz
2013-06-18 8:55 ` Florian Vaussard
2013-05-30 13:51 ` Florian Vaussard [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1369921916-7435-4-git-send-email-florian.vaussard@epfl.ch \
--to=florian.vaussard@epfl.ch \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).