aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/twl4030-power.c
diff options
context:
space:
mode:
authorFlorian Vaussard <florian.vaussard@epfl.ch>2013-06-18 09:17:59 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-19 04:19:40 -0400
commite77a4c2fdd549efbd4897522d83005f9a5f81c87 (patch)
treef9ffd46ebad8459460415368c9b8fc6598fa8bfd /drivers/mfd/twl4030-power.c
parentb0fc1da4d0359d3cce8f12e0f014aed0704ae202 (diff)
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/twl4030-power.c')
-rw-r--r--drivers/mfd/twl4030-power.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 5b2848280f4b..d027581e7eb2 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)
567 567
568 err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1, 568 err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1,
569 TWL4030_PM_MASTER_PROTECT_KEY); 569 TWL4030_PM_MASTER_PROTECT_KEY);
570 if (err) 570 err |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER,
571 goto unlock; 571 TWL4030_PM_MASTER_KEY_CFG2,
572
573 err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG2,
574 TWL4030_PM_MASTER_PROTECT_KEY); 572 TWL4030_PM_MASTER_PROTECT_KEY);
575 if (err) 573
576 goto unlock; 574 if (err) {
575 pr_err("TWL4030 Unable to unlock registers\n");
576 return err;
577 }
577 578
578 if (pdata) { 579 if (pdata) {
579 /* TODO: convert to device tree */ 580 /* TODO: convert to device tree */
580 err = twl4030_power_configure_scripts(pdata); 581 err = twl4030_power_configure_scripts(pdata);
581 if (err) 582 if (err) {
582 goto load; 583 pr_err("TWL4030 failed to load scripts\n");
584 return err;
585 }
583 err = twl4030_power_configure_resources(pdata); 586 err = twl4030_power_configure_resources(pdata);
584 if (err) 587 if (err) {
585 goto resource; 588 pr_err("TWL4030 failed to configure resource\n");
589 return err;
590 }
586 } 591 }
587 592
588 /* Board has to be wired properly to use this feature */ 593 /* Board has to be wired properly to use this feature */
@@ -612,19 +617,6 @@ relock:
612 if (err) 617 if (err)
613 pr_err("TWL4030 Unable to relock registers\n"); 618 pr_err("TWL4030 Unable to relock registers\n");
614 return err; 619 return err;
615
616unlock:
617 if (err)
618 pr_err("TWL4030 Unable to unlock registers\n");
619 return err;
620load:
621 if (err)
622 pr_err("TWL4030 failed to load scripts\n");
623 return err;
624resource:
625 if (err)
626 pr_err("TWL4030 failed to configure resource\n");
627 return err;
628} 620}
629 621
630static int twl4030_power_remove(struct platform_device *pdev) 622static int twl4030_power_remove(struct platform_device *pdev)