From 3e2b9abda554e9f6105996dca77cca9ef98de17a Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 10 Mar 2009 16:28:36 +0000 Subject: regulator: Don't warn on omitted voltage constraints 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 Signed-off-by: Liam Girdwood --- drivers/regulator/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index da357a07c98e..2ff76349f392 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -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; -- cgit v1.2.2