From: Axel Lin Date: Mon, 19 Apr 2010 01:58:02 +0000 (+0800) Subject: mc13783-regulator: fix a memory leak in mc13783_regulator_remove X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=58d57658834faa0c19da35e84632f7b78846f69f;p=openwrt%2Fstaging%2Fblogic.git 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 Cc: Sascha Hauer Cc: Liam Girdwood Cc: Mark Brown Cc: Samuel Ortiz Signed-off-by: Liam Girdwood --- diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c index a681f5e8f786..ad036dd8da13 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; }