regulator: tps80031: adjust tolerance if req minuV > dev minuV
[linux-2.6.git] / drivers / regulator / mc13892-regulator.c
index 46bfa4a..845aa22 100644 (file)
@@ -538,7 +538,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
        if (num_regulators <= 0)
                return -EINVAL;
 
-       priv = kzalloc(sizeof(*priv) +
+       priv = devm_kzalloc(&pdev->dev, sizeof(*priv) +
                num_regulators * sizeof(priv->regulators[0]),
                GFP_KERNEL);
        if (!priv)
@@ -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) {
@@ -562,7 +562,7 @@ 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 |
@@ -570,7 +570,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
                        MC13892_SWITCHERS5_SW3MODE_AUTO |
                        MC13892_SWITCHERS5_SW4MODE_AUTO);
                if (ret)
-                       goto err_free;
+                       goto err_unlock;
        }
        mc13xxx_unlock(mc13892);
 
@@ -612,11 +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);
-       kfree(priv);
-
        return ret;
 }
 
@@ -630,7 +629,6 @@ static int __devexit mc13892_regulator_remove(struct platform_device *pdev)
        for (i = 0; i < priv->num_regulators; i++)
                regulator_unregister(priv->regulators[i]);
 
-       kfree(priv);
        return 0;
 }