From 230a5a1c41464f7fe5b676c21280ae4effa222c8 Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
Date: Fri, 15 Jun 2012 18:25:08 +0100
Subject: [PATCH] regulator: Fix double free in devm_regulator_put()

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 663ebd534ef9..729b20d1c1de 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);
-- 
GitLab