]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
regulator: move set_machine_constraints after regulator device initialization
authorMike Rapoport <mike@compulab.co.il>
Tue, 25 Nov 2008 12:53:53 +0000 (14:53 +0200)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Thu, 8 Jan 2009 20:10:31 +0000 (20:10 +0000)
Calling set_machine_constraints before regulator device initialization
causes crash when constraints have apply_uV set.

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
drivers/regulator/core.c

index 9a5ff97d158df14be119709c0b79bc0e403379e6..895f73887cf06b2e3240bb67b8fd2d1e606421a6 100644 (file)
@@ -1858,11 +1858,6 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
                        goto clean;
        }
 
-       /* set regulator constraints */
-       ret = set_machine_constraints(rdev, &init_data->constraints);
-       if (ret < 0)
-               goto clean;
-
        /* register with sysfs */
        rdev->dev.class = &regulator_class;
        rdev->dev.parent = dev;
@@ -1874,6 +1869,11 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
 
        dev_set_drvdata(&rdev->dev, rdev);
 
+       /* set regulator constraints */
+       ret = set_machine_constraints(rdev, &init_data->constraints);
+       if (ret < 0)
+               goto scrub;
+
        /* add attributes supported by this regulator */
        ret = add_regulator_attributes(rdev);
        if (ret < 0)