Skip to content

Commit 80099c7

Browse files
error27Liam Girdwood
authored andcommitted
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>
1 parent 9a767d4 commit 80099c7

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎drivers/regulator/fixed.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,10 @@ static int regulator_fixed_voltage_remove(struct platform_device *pdev)
196196
struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
197197

198198
regulator_unregister(drvdata->dev);
199-
kfree(drvdata->desc.name);
200-
kfree(drvdata);
201-
202199
if (gpio_is_valid(drvdata->gpio))
203200
gpio_free(drvdata->gpio);
201+
kfree(drvdata->desc.name);
202+
kfree(drvdata);
204203

205204
return 0;
206205
}

0 commit comments

Comments
 (0)