Skip to content

Commit

Permalink
regulator: Fix the error handling if create_regulator fails
Browse files Browse the repository at this point in the history
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 <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Axel Lin authored and Mark Brown committed Dec 29, 2011
1 parent a398eaa commit bcda432
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
if (regulator == NULL) {
regulator = ERR_PTR(-ENOMEM);
module_put(rdev->owner);
goto out;
}

rdev->open_count++;
Expand Down

0 comments on commit bcda432

Please sign in to comment.