From: Mike Rapoport Date: Tue, 25 Nov 2008 12:53:53 +0000 (+0200) Subject: regulator: move set_machine_constraints after regulator device initialization X-Git-Tag: Ubuntu-5.10.0-12.13~34645^2~8 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=74f544c1fc0339acf6f66ff438b8543b1f9faf10;p=mirror_ubuntu-hirsute-kernel.git regulator: move set_machine_constraints after regulator device initialization Calling set_machine_constraints before regulator device initialization causes crash when constraints have apply_uV set. Signed-off-by: Mike Rapoport Signed-off-by: Liam Girdwood --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 9a5ff97d158d..895f73887cf0 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -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 = ®ulator_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)