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>
This commit is contained in:
parent
b0fc1da4d0
commit
e77a4c2fdd
|
@ -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,
|
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1,
|
||||||
TWL4030_PM_MASTER_PROTECT_KEY);
|
TWL4030_PM_MASTER_PROTECT_KEY);
|
||||||
if (err)
|
err |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER,
|
||||||
goto unlock;
|
TWL4030_PM_MASTER_KEY_CFG2,
|
||||||
|
|
||||||
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG2,
|
|
||||||
TWL4030_PM_MASTER_PROTECT_KEY);
|
TWL4030_PM_MASTER_PROTECT_KEY);
|
||||||
if (err)
|
|
||||||
goto unlock;
|
if (err) {
|
||||||
|
pr_err("TWL4030 Unable to unlock registers\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
if (pdata) {
|
if (pdata) {
|
||||||
/* TODO: convert to device tree */
|
/* TODO: convert to device tree */
|
||||||
err = twl4030_power_configure_scripts(pdata);
|
err = twl4030_power_configure_scripts(pdata);
|
||||||
if (err)
|
if (err) {
|
||||||
goto load;
|
pr_err("TWL4030 failed to load scripts\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
err = twl4030_power_configure_resources(pdata);
|
err = twl4030_power_configure_resources(pdata);
|
||||||
if (err)
|
if (err) {
|
||||||
goto resource;
|
pr_err("TWL4030 failed to configure resource\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Board has to be wired properly to use this feature */
|
/* Board has to be wired properly to use this feature */
|
||||||
|
@ -612,19 +617,6 @@ relock:
|
||||||
if (err)
|
if (err)
|
||||||
pr_err("TWL4030 Unable to relock registers\n");
|
pr_err("TWL4030 Unable to relock registers\n");
|
||||||
return err;
|
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)
|
static int twl4030_power_remove(struct platform_device *pdev)
|
||||||
|
|
Loading…
Reference in a new issue