Skip to content

Commit

Permalink
dereferencing freed memory regulator_fixed_voltage_remove()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Liam Girdwood committed Nov 16, 2009
1 parent 9a767d4 commit 80099c7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/regulator/fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 80099c7

Please sign in to comment.