diff options
author | Florian Vaussard <florian.vaussard@epfl.ch> | 2013-06-18 15:17:59 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-19 10:19:40 +0200 |
commit | e77a4c2fdd549efbd4897522d83005f9a5f81c87 (patch) | |
tree | f9ffd46ebad8459460415368c9b8fc6598fa8bfd /drivers/mfd | |
parent | b0fc1da4d0359d3cce8f12e0f014aed0704ae202 (diff) | |
download | op-kernel-dev-e77a4c2fdd549efbd4897522d83005f9a5f81c87.zip op-kernel-dev-e77a4c2fdd549efbd4897522d83005f9a5f81c87.tar.gz |
mfd: twl4030-power: Simplify error path
Remove unnecessary goto statements, causing duplicated if
conditions.
Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/twl4030-power.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index 5b28482..d027581 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c @@ -567,22 +567,27 @@ 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) { /* TODO: convert to device tree */ 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 */ @@ -612,19 +617,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) |