Skip to content

Commit

Permalink
REGULATOR Handle positive returncode from enable
Browse files Browse the repository at this point in the history
This makes _regulator_enable() properly handle the case where
a regulator is already on when you try to enable it. Currently
it will erroneously handle positive return values as an error.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Linus Walleij authored and Liam Girdwood committed Sep 22, 2009
1 parent 9e108d3 commit a7433cf
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 @@ -1236,11 +1236,12 @@ static int _regulator_enable(struct regulator_dev *rdev)
} else {
return -EINVAL;
}
} else {
} else if (ret < 0) {
printk(KERN_ERR "%s: is_enabled() failed for %s: %d\n",
__func__, rdev->desc->name, ret);
return ret;
}
/* Fallthrough on positive return values - already enabled */
}

rdev->use_count++;
Expand Down

0 comments on commit a7433cf

Please sign in to comment.