Skip to content

Commit

Permalink
regulator: Don't warn on omitted voltage constraints
Browse files Browse the repository at this point in the history
Specifying voltage constraints is optional (and only needed if the
consumer is allowed to change the voltage) so don't complain unless
a voltage has been specified.

Also avoid surprises with a dangling else while we're here.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Mark Brown authored and Liam Girdwood committed Mar 31, 2009
1 parent 216765d commit 3e2b9ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,12 @@ static int set_machine_constraints(struct regulator_dev *rdev,
cmax = INT_MAX;
}

/* voltage constraints are optional */
if ((cmin == 0) && (cmax == 0))
goto out;

/* else require explicit machine-level constraints */
else if (cmin <= 0 || cmax <= 0 || cmax < cmin) {
if (cmin <= 0 || cmax <= 0 || cmax < cmin) {
pr_err("%s: %s '%s' voltage constraints\n",
__func__, "invalid", name);
ret = -EINVAL;
Expand Down

0 comments on commit 3e2b9ab

Please sign in to comment.