summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2009-11-16 10:05:03 +0100
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-11-16 13:40:25 +0100
commit80099c707e0915ac3159ddc70fb714adbb3d53e3 (patch)
tree621aefafce62e64ab79a999b9cd4bebe9ef47e6d /drivers/regulator
parentregulator: Fix check of unsigned return value and transmit errors in wm831x_g... (diff)
downloadlinux-80099c707e0915ac3159ddc70fb714adbb3d53e3.tar.xz
linux-80099c707e0915ac3159ddc70fb714adbb3d53e3.zip
dereferencing freed memory regulator_fixed_voltage_remove()
Don't dereference drvdata after it has been freed. regards, dan carpenter Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/fixed.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index f8b295700d7d..f9f516a3028a 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -196,11 +196,10 @@ static int regulator_fixed_voltage_remove(struct platform_device *pdev)
struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
regulator_unregister(drvdata->dev);
- kfree(drvdata->desc.name);
- kfree(drvdata);
-
if (gpio_is_valid(drvdata->gpio))
gpio_free(drvdata->gpio);
+ kfree(drvdata->desc.name);
+ kfree(drvdata);
return 0;
}