diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-10 12:42:53 +0900 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-10 12:42:53 +0900 |
commit | 4e62cce2b62d5bdb10790e6cf0893b84dae84de8 (patch) | |
tree | 0c05ae5a0fc201957221da5fc296fd47fbcb9946 /drivers/regulator | |
parent | 6234427eb8b3c4cd329bcb68773d1e5389b3f83b (diff) | |
parent | 1e369bcd032e3fb76e232be9c5642b0833ba62f4 (diff) |
Merge remote-tracking branch 'regulator/topic/da9052' into regulator-next
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/da9052-regulator.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index 27355b1199e5..0a2586a39e6a 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c @@ -129,17 +129,17 @@ static int da9052_dcdc_set_current_limit(struct regulator_dev *rdev, int min_uA, else if (offset == 0) row = 1; - if (min_uA > da9052_current_limits[row][DA9052_MAX_UA] || - max_uA < da9052_current_limits[row][DA9052_MIN_UA]) - return -EINVAL; - for (i = DA9052_CURRENT_RANGE - 1; i >= 0; i--) { - if (da9052_current_limits[row][i] <= max_uA) { + if ((min_uA <= da9052_current_limits[row][i]) && + (da9052_current_limits[row][i] <= max_uA)) { reg_val = i; break; } } + if (i < 0) + return -EINVAL; + /* Determine the even or odd position of the buck current limit * register field */ |