diff options
author | Vasiliy Kulikov <segooon@gmail.com> | 2010-09-19 08:55:01 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-10-02 07:50:30 -0400 |
commit | ad7725cb43b8badb2fec2c2bfca07c067f2e19a7 (patch) | |
tree | 16c7c2a6ec9605be409677eb1bf1993d208fd4be /drivers | |
parent | c6ea21e35bf3691cad59647c771e6606067f627d (diff) |
regulator: fix device_register() error handling
If device_register() fails then call put_device().
See comment to device_register.
Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/regulator/core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 422a709d271d..a43eedb214bb 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -2302,8 +2302,10 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | |||
2302 | dev_set_name(&rdev->dev, "regulator.%d", | 2302 | dev_set_name(&rdev->dev, "regulator.%d", |
2303 | atomic_inc_return(®ulator_no) - 1); | 2303 | atomic_inc_return(®ulator_no) - 1); |
2304 | ret = device_register(&rdev->dev); | 2304 | ret = device_register(&rdev->dev); |
2305 | if (ret != 0) | 2305 | if (ret != 0) { |
2306 | put_device(&rdev->dev); | ||
2306 | goto clean; | 2307 | goto clean; |
2308 | } | ||
2307 | 2309 | ||
2308 | dev_set_drvdata(&rdev->dev, rdev); | 2310 | dev_set_drvdata(&rdev->dev, rdev); |
2309 | 2311 | ||