From: Axel Lin Date: Thu, 29 Dec 2011 09:02:08 +0000 (+0800) Subject: regulator: Fix the error handling if create_regulator fails X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bcda432194fc7c4a2dbe9d7146f00b4b21e66c8c;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git regulator: Fix the error handling if create_regulator fails In the case of create_regulator() fails, goto the error path immediately. It does not make sense to update rdev->open_count if create_regulator fails. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 6f7d411b048b..6cb9d399affd 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1282,6 +1282,7 @@ found: if (regulator == NULL) { regulator = ERR_PTR(-ENOMEM); module_put(rdev->owner); + goto out; } rdev->open_count++;