mc13783-regulator: fix a memory leak in mc13783_regulator_remove
authorAxel Lin <axel.lin@gmail.com>
Mon, 19 Apr 2010 01:58:02 +0000 (09:58 +0800)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Mon, 19 Apr 2010 12:29:16 +0000 (13:29 +0100)
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

index a681f5e8f78602db461bb44d2e089367a4498476..ad036dd8da136852bd1490eff9c36807a1bfef0a 100644 (file)
@@ -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;
 }