public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 08/14] regulator: fix device_register() error handling
@ 2010-09-19 12:55 Vasiliy Kulikov
  2010-09-19 15:02 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Vasiliy Kulikov @ 2010-09-19 12:55 UTC (permalink / raw)
  To: kernel-janitors
  Cc: Liam Girdwood, Mark Brown, Jani Nikula, Linus Walleij, Tejun Heo,
	linux-kernel

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

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
---
 compile tested.

 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 422a709..a43eedb 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,
 	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);
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 08/14] regulator: fix device_register() error handling
  2010-09-19 12:55 [PATCH 08/14] regulator: fix device_register() error handling Vasiliy Kulikov
@ 2010-09-19 15:02 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2010-09-19 15:02 UTC (permalink / raw)
  To: Vasiliy Kulikov
  Cc: kernel-janitors, Liam Girdwood, Jani Nikula, Linus Walleij,
	Tejun Heo, linux-kernel

On Sun, Sep 19, 2010 at 04:55:01PM +0400, Vasiliy Kulikov wrote:
> 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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-19 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-19 12:55 [PATCH 08/14] regulator: fix device_register() error handling Vasiliy Kulikov
2010-09-19 15:02 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox