diff options
author | Florian Vaussard <florian.vaussard@epfl.ch> | 2013-06-18 09:18:00 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-19 04:19:40 -0400 |
commit | cb3cabd6788dd8c2e87dc7262a45a24e063681a3 (patch) | |
tree | ff5c4fe3b65c64540f00e2ed20e41db2b151bedd /drivers/mfd/twl4030-power.c | |
parent | e77a4c2fdd549efbd4897522d83005f9a5f81c87 (diff) |
mfd: twl4030-power: Fix relocking on error
If an error occurs when loading power scripts or resources, the
registers are not correctly relocked. Fix it.
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.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index d027581e7eb2..a5fd3c738211 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c | |||
@@ -558,6 +558,7 @@ int twl4030_power_probe(struct platform_device *pdev) | |||
558 | struct twl4030_power_data *pdata = pdev->dev.platform_data; | 558 | struct twl4030_power_data *pdata = pdev->dev.platform_data; |
559 | struct device_node *node = pdev->dev.of_node; | 559 | struct device_node *node = pdev->dev.of_node; |
560 | int err = 0; | 560 | int err = 0; |
561 | int err2 = 0; | ||
561 | u8 val; | 562 | u8 val; |
562 | 563 | ||
563 | if (!pdata && !node) { | 564 | if (!pdata && !node) { |
@@ -581,12 +582,12 @@ int twl4030_power_probe(struct platform_device *pdev) | |||
581 | err = twl4030_power_configure_scripts(pdata); | 582 | err = twl4030_power_configure_scripts(pdata); |
582 | if (err) { | 583 | if (err) { |
583 | pr_err("TWL4030 failed to load scripts\n"); | 584 | pr_err("TWL4030 failed to load scripts\n"); |
584 | return err; | 585 | goto relock; |
585 | } | 586 | } |
586 | err = twl4030_power_configure_resources(pdata); | 587 | err = twl4030_power_configure_resources(pdata); |
587 | if (err) { | 588 | if (err) { |
588 | pr_err("TWL4030 failed to configure resource\n"); | 589 | pr_err("TWL4030 failed to configure resource\n"); |
589 | return err; | 590 | goto relock; |
590 | } | 591 | } |
591 | } | 592 | } |
592 | 593 | ||
@@ -612,10 +613,13 @@ int twl4030_power_probe(struct platform_device *pdev) | |||
612 | } | 613 | } |
613 | 614 | ||
614 | relock: | 615 | relock: |
615 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0, | 616 | err2 = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0, |
616 | TWL4030_PM_MASTER_PROTECT_KEY); | 617 | TWL4030_PM_MASTER_PROTECT_KEY); |
617 | if (err) | 618 | if (err2) { |
618 | pr_err("TWL4030 Unable to relock registers\n"); | 619 | pr_err("TWL4030 Unable to relock registers\n"); |
620 | return err2; | ||
621 | } | ||
622 | |||
619 | return err; | 623 | return err; |
620 | } | 624 | } |
621 | 625 | ||