From: Dan Carpenter Date: Mon, 16 Nov 2009 09:05:03 +0000 (+0200) Subject: dereferencing freed memory regulator_fixed_voltage_remove() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=80099c707e0915ac3159ddc70fb714adbb3d53e3;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git dereferencing freed memory regulator_fixed_voltage_remove() Don't dereference drvdata after it has been freed. regards, dan carpenter Signed-off-by: Dan Carpenter Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- 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; }