Skip to content

Commit

Permalink
mfd: twl4030-power: Fix relocking on error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Florian Vaussard authored and Samuel Ortiz committed Jun 19, 2013
1 parent e77a4c2 commit cb3cabd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/mfd/twl4030-power.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ int twl4030_power_probe(struct platform_device *pdev)
struct twl4030_power_data *pdata = pdev->dev.platform_data;
struct device_node *node = pdev->dev.of_node;
int err = 0;
int err2 = 0;
u8 val;

if (!pdata && !node) {
Expand All @@ -581,12 +582,12 @@ int twl4030_power_probe(struct platform_device *pdev)
err = twl4030_power_configure_scripts(pdata);
if (err) {
pr_err("TWL4030 failed to load scripts\n");
return err;
goto relock;
}
err = twl4030_power_configure_resources(pdata);
if (err) {
pr_err("TWL4030 failed to configure resource\n");
return err;
goto relock;
}
}

Expand All @@ -612,10 +613,13 @@ int twl4030_power_probe(struct platform_device *pdev)
}

relock:
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0,
err2 = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0,
TWL4030_PM_MASTER_PROTECT_KEY);
if (err)
if (err2) {
pr_err("TWL4030 Unable to relock registers\n");
return err2;
}

return err;
}

Expand Down

0 comments on commit cb3cabd

Please sign in to comment.