Commit f89ba338 authored by Mark Brown's avatar Mark Brown

Merge branch 'topic/sysfs-init' of...

Merge branch 'topic/sysfs-init' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-supply
parents 8e5356a7 469b640e
...@@ -3961,13 +3961,6 @@ regulator_register(const struct regulator_desc *regulator_desc, ...@@ -3961,13 +3961,6 @@ regulator_register(const struct regulator_desc *regulator_desc,
rdev->dev.parent = dev; rdev->dev.parent = dev;
dev_set_name(&rdev->dev, "regulator.%lu", dev_set_name(&rdev->dev, "regulator.%lu",
(unsigned long) atomic_inc_return(&regulator_no)); (unsigned long) atomic_inc_return(&regulator_no));
ret = device_register(&rdev->dev);
if (ret != 0) {
put_device(&rdev->dev);
goto wash;
}
dev_set_drvdata(&rdev->dev, rdev);
/* set regulator constraints */ /* set regulator constraints */
if (init_data) if (init_data)
...@@ -3975,7 +3968,15 @@ regulator_register(const struct regulator_desc *regulator_desc, ...@@ -3975,7 +3968,15 @@ regulator_register(const struct regulator_desc *regulator_desc,
ret = set_machine_constraints(rdev, constraints); ret = set_machine_constraints(rdev, constraints);
if (ret < 0) if (ret < 0)
goto scrub; goto wash;
ret = device_register(&rdev->dev);
if (ret != 0) {
put_device(&rdev->dev);
goto wash;
}
dev_set_drvdata(&rdev->dev, rdev);
if (init_data && init_data->supply_regulator) if (init_data && init_data->supply_regulator)
rdev->supply_name = init_data->supply_regulator; rdev->supply_name = init_data->supply_regulator;
...@@ -4007,14 +4008,13 @@ regulator_register(const struct regulator_desc *regulator_desc, ...@@ -4007,14 +4008,13 @@ regulator_register(const struct regulator_desc *regulator_desc,
unset_supplies: unset_supplies:
unset_regulator_supplies(rdev); unset_regulator_supplies(rdev);
scrub:
regulator_ena_gpio_free(rdev); regulator_ena_gpio_free(rdev);
device_unregister(&rdev->dev); device_unregister(&rdev->dev);
/* device core frees rdev */ /* device core frees rdev */
goto out; goto out;
wash: wash:
kfree(rdev->constraints);
regulator_ena_gpio_free(rdev); regulator_ena_gpio_free(rdev);
clean: clean:
kfree(rdev); kfree(rdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment