From: Vasiliy Kulikov Date: Sun, 19 Sep 2010 12:55:01 +0000 (+0400) Subject: regulator: fix device_register() error handling X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ad7725cb43b8badb2fec2c2bfca07c067f2e19a7;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git regulator: fix device_register() error handling If device_register() fails then call put_device(). See comment to device_register. Signed-off-by: Vasiliy Kulikov Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 422a709d271d..a43eedb214bb 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2302,8 +2302,10 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, dev_set_name(&rdev->dev, "regulator.%d", atomic_inc_return(®ulator_no) - 1); ret = device_register(&rdev->dev); - if (ret != 0) + if (ret != 0) { + put_device(&rdev->dev); goto clean; + } dev_set_drvdata(&rdev->dev, rdev);