Skip to content

Commit

Permalink
regulator: Fix unbalanced lock/unlock in mc13892_regulator_probe erro…
Browse files Browse the repository at this point in the history
…r path

We do not hold a lock while registering regulator, thus should not call unlock
if regulator_register fails.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Axel Lin authored and Mark Brown committed Mar 26, 2012
1 parent 09bf14b commit 5777d9b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/regulator/mc13892-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
mc13xxx_lock(mc13892);
ret = mc13xxx_reg_read(mc13892, MC13892_REVISION, &val);
if (ret)
goto err_free;
goto err_unlock;

/* enable switch auto mode */
if ((val & 0x0000FFFF) == 0x45d0) {
Expand All @@ -562,15 +562,15 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
MC13892_SWITCHERS4_SW1MODE_AUTO |
MC13892_SWITCHERS4_SW2MODE_AUTO);
if (ret)
goto err_free;
goto err_unlock;

ret = mc13xxx_reg_rmw(mc13892, MC13892_SWITCHERS5,
MC13892_SWITCHERS5_SW3MODE_M |
MC13892_SWITCHERS5_SW4MODE_M,
MC13892_SWITCHERS5_SW3MODE_AUTO |
MC13892_SWITCHERS5_SW4MODE_AUTO);
if (ret)
goto err_free;
goto err_unlock;
}
mc13xxx_unlock(mc13892);

Expand Down Expand Up @@ -612,10 +612,10 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
err:
while (--i >= 0)
regulator_unregister(priv->regulators[i]);
return ret;

err_free:
err_unlock:
mc13xxx_unlock(mc13892);

return ret;
}

Expand Down

0 comments on commit 5777d9b

Please sign in to comment.