dereferencing freed memory regulator_fixed_voltage_remove()
authorDan Carpenter <error27@gmail.com>
Mon, 16 Nov 2009 09:05:03 +0000 (11:05 +0200)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Mon, 16 Nov 2009 12:40:25 +0000 (12:40 +0000)
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>
drivers/regulator/fixed.c

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