mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 17:41:50 +00:00
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>
This commit is contained in:
parent
e77a4c2fdd
commit
cb3cabd678
1 changed files with 8 additions and 4 deletions
|
@ -558,6 +558,7 @@ int twl4030_power_probe(struct platform_device *pdev)
|
||||||
struct twl4030_power_data *pdata = pdev->dev.platform_data;
|
struct twl4030_power_data *pdata = pdev->dev.platform_data;
|
||||||
struct device_node *node = pdev->dev.of_node;
|
struct device_node *node = pdev->dev.of_node;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
int err2 = 0;
|
||||||
u8 val;
|
u8 val;
|
||||||
|
|
||||||
if (!pdata && !node) {
|
if (!pdata && !node) {
|
||||||
|
@ -581,12 +582,12 @@ int twl4030_power_probe(struct platform_device *pdev)
|
||||||
err = twl4030_power_configure_scripts(pdata);
|
err = twl4030_power_configure_scripts(pdata);
|
||||||
if (err) {
|
if (err) {
|
||||||
pr_err("TWL4030 failed to load scripts\n");
|
pr_err("TWL4030 failed to load scripts\n");
|
||||||
return err;
|
goto relock;
|
||||||
}
|
}
|
||||||
err = twl4030_power_configure_resources(pdata);
|
err = twl4030_power_configure_resources(pdata);
|
||||||
if (err) {
|
if (err) {
|
||||||
pr_err("TWL4030 failed to configure resource\n");
|
pr_err("TWL4030 failed to configure resource\n");
|
||||||
return err;
|
goto relock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,10 +613,13 @@ int twl4030_power_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
relock:
|
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);
|
TWL4030_PM_MASTER_PROTECT_KEY);
|
||||||
if (err)
|
if (err2) {
|
||||||
pr_err("TWL4030 Unable to relock registers\n");
|
pr_err("TWL4030 Unable to relock registers\n");
|
||||||
|
return err2;
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue