Re: [PATCH V2 17/18] regulator: twl: use devm_regulator_register()

From: Jingoo Han
Date: Thu Sep 26 2013 - 03:12:06 EST


On Thursday, September 26, 2013 11:13 AM, Jingoo Han wrote:
>
> Use devm_regulator_register() to make cleanup paths simpler.
>
> Signed-off-by: Jingoo Han <jg1.han@xxxxxxxxxxx>
> Acked-by: Nishanth Menon <nm@xxxxxx>
> ---
> drivers/regulator/twl-regulator.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

[.....]

> @@ -1217,7 +1217,6 @@ static int twlreg_remove(struct platform_device *pdev)
> struct regulator_dev *rdev = platform_get_drvdata(pdev);
> struct twlreg_info *info = rdev->reg_data;
>
> - regulator_unregister(rdev);
> kfree(info);
> return 0;
> }

kfree(info) is kfree(rdev->reg_data).
The following would be right.
1. kfree(rdev->reg_data)
2. regulator_unregister(rdev)

Also, regulator_unregister() does not access 'rdev->reg_data'.
So, it would not make the problem.

Best regards,
Jingoo Han

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/