mc13783-regulator: fix a memory leak in mc13783_regulator_remove

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, April 21, 2010 - 12:59 pm

Gitweb:     http://git.kernel.org/linus/58d57658834faa0c19da35e84632f7b78846f69f
Commit:     58d57658834faa0c19da35e84632f7b78846f69f
Parent:     be1a50d4eba4cdb3ebf9d97a0a8693c153436775
Author:     Axel Lin <axel.lin@gmail.com>
AuthorDate: Mon Apr 19 09:58:02 2010 +0800
Committer:  Liam Girdwood <lrg@slimlogic.co.uk>
CommitDate: Mon Apr 19 13:29:16 2010 +0100

    mc13783-regulator: fix a memory leak in mc13783_regulator_remove
    
    This patch fixes a memory leak by freeing priv in mc13783_regulator_remove
    
    Signed-off-by: Axel Lin <axel.lin@gmail.com>
    Cc: Sascha Hauer <s.hauer@pengutronix.de>
    Cc: Liam Girdwood <lrg@slimlogic.co.uk>
    Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Cc: Samuel Ortiz <sameo@linux.intel.com>
    Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
---
 drivers/regulator/mc13783-regulator.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c
index a681f5e..ad036dd 100644
--- a/drivers/regulator/mc13783-regulator.c
+++ b/drivers/regulator/mc13783-regulator.c
@@ -618,9 +618,12 @@ static int __devexit mc13783_regulator_remove(struct platform_device *pdev)
 		dev_get_platdata(&pdev->dev);
 	int i;
 
+	platform_set_drvdata(pdev, NULL);
+
 	for (i = 0; i < pdata->num_regulators; i++)
 		regulator_unregister(priv->regulators[i]);
 
+	kfree(priv);
 	return 0;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
mc13783-regulator: fix a memory leak in mc13783_regulator_ ..., Linux Kernel Mailing ..., (Wed Apr 21, 12:59 pm)