Skip to content

Commit

Permalink
regulator: move set_machine_constraints after regulator device initia…
Browse files Browse the repository at this point in the history
…lization

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>
  • Loading branch information
Mike Rapoport authored and Liam Girdwood committed Jan 8, 2009
1 parent 9618690 commit 74f544c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit 74f544c

Please sign in to comment.