Skip to contentSkip to conversation

regulator: fix device_register() error handling

PATCH Applied Vasiliy Kulikov 2 participants 2 messages Sep 19, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 8/14 regulator: fix device_register() error handling

If device_register() fails then call put_device(). See comment to device_register.

---
compile tested.

 drivers/regulator/core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/regulator/core.c +3 -1
index 422a709..a43eedb 100644
@@ -2302,8 +2302,10 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
 	dev_set_name(&rdev->dev, "regulator.%d",
 		     atomic_inc_return(&regulator_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);
 
Signature · 1 line
1.7.0.4