Skip to content

Commit

Permalink
regulator: core: Always use return value when regulator_dev_lookup() …
Browse files Browse the repository at this point in the history
…fails

Ensure that the return value is always set when we return now that the
logic has changed for regulator_get_optional() so we don't get missing
codes leaking out.

Reported-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Mark Brown committed Sep 24, 2013
1 parent 9b92da1 commit ef60abb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1263,12 +1263,13 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
if (rdev)
goto found;

regulator = ERR_PTR(ret);

/*
* If we have return value from dev_lookup fail, we do not expect to
* succeed, so, quit with appropriate error value
*/
if (ret && ret != -ENODEV) {
regulator = ERR_PTR(ret);
goto out;
}

Expand Down

0 comments on commit ef60abb

Please sign in to comment.