mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
c6ea21e35b
commit
ad7725cb43
|
@ -2302,8 +2302,10 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
|
|||
dev_set_name(&rdev->dev, "regulator.%d",
|
||||
atomic_inc_return(®ulator_no) - 1);
|
||||
ret = device_register(&rdev->dev);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
put_device(&rdev->dev);
|
||||
goto clean;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&rdev->dev, rdev);
|
||||
|
||||
|
|
Loading…
Reference in New Issue