Skip to content

Commit

Permalink
regulator: Fix checking return value of create_regulator
Browse files Browse the repository at this point in the history
create_regulator() returns NULL on fail.

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 bcda432 commit 32c78de
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,9 +985,8 @@ static int set_supply(struct regulator_dev *rdev,
rdev_info(rdev, "supplied by %s\n", rdev_get_name(supply_rdev));

rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY");
if (IS_ERR(rdev->supply)) {
err = PTR_ERR(rdev->supply);
rdev->supply = NULL;
if (rdev->supply == NULL) {
err = -ENOMEM;
return err;
}

Expand Down

0 comments on commit 32c78de

Please sign in to comment.