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 a681f5e..ad036dd 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;
 }