diff options
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, | |||
129 | else if (offset == 0) | 129 | else if (offset == 0) |
130 | row = 1; | 130 | row = 1; |
131 | 131 | ||
132 | if (min_uA > da9052_current_limits[row][DA9052_MAX_UA] || | ||
133 | max_uA < da9052_current_limits[row][DA9052_MIN_UA]) | ||
134 | return -EINVAL; | ||
135 | |||
136 | for (i = DA9052_CURRENT_RANGE - 1; i >= 0; i--) { | 132 | for (i = DA9052_CURRENT_RANGE - 1; i >= 0; i--) { |
137 | if (da9052_current_limits[row][i] <= max_uA) { | 133 | if ((min_uA <= da9052_current_limits[row][i]) && |
134 | (da9052_current_limits[row][i] <= max_uA)) { | ||
138 | reg_val = i; | 135 | reg_val = i; |
139 | break; | 136 | break; |
140 | } | 137 | } |
141 | } | 138 | } |
142 | 139 | ||
140 | if (i < 0) | ||
141 | return -EINVAL; | ||
142 | |||
143 | /* Determine the even or odd position of the buck current limit | 143 | /* Determine the even or odd position of the buck current limit |
144 | * register field | 144 | * register field |
145 | */ | 145 | */ |