The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] regulator: Fix double free in devm_regulator_put()
@ 2012-06-15 17:55 Mark Brown
  2012-06-15 18:03 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2012-06-15 17:55 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: linux-kernel, Mark Brown

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/regulator/core.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 63507a5..a2c5cfb 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1461,9 +1461,7 @@ void devm_regulator_put(struct regulator *regulator)
 
 	rc = devres_release(regulator->dev, devm_regulator_release,
 			    devm_regulator_match, regulator);
-	if (rc == 0)
-		regulator_put(regulator);
-	else
+	if (rc != 0)
 		WARN_ON(rc);
 }
 EXPORT_SYMBOL_GPL(devm_regulator_put);
-- 
1.7.10


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

* Re: [PATCH] regulator: Fix double free in devm_regulator_put()
  2012-06-15 17:55 [PATCH] regulator: Fix double free in devm_regulator_put() Mark Brown
@ 2012-06-15 18:03 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2012-06-15 18:03 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel

On Fri, 2012-06-15 at 18:55 +0100, Mark Brown wrote:
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
[]
> @@ -1461,9 +1461,7 @@ void devm_regulator_put(struct regulator *regulator)
>  
>  	rc = devres_release(regulator->dev, devm_regulator_release,
>  			    devm_regulator_match, regulator);
> -	if (rc == 0)
> -		regulator_put(regulator);
> -	else
> +	if (rc != 0)
>  		WARN_ON(rc);

Seems an odd style choice.  Perhaps:

	rc = devres_release(regulator->dev, devm_regulator_release,
			    devm_regulator_match, regulator);
	WARN_ON(rc);



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

end of thread, other threads:[~2012-06-15 18:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-15 17:55 [PATCH] regulator: Fix double free in devm_regulator_put() Mark Brown
2012-06-15 18:03 ` Joe Perches

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