diff options
| -rw-r--r-- | drivers/regulator/max8998.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index 03e55a18a2ad..ab67298799f9 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c | |||
| @@ -119,7 +119,7 @@ static int max8998_list_voltage(struct regulator_dev *rdev, | |||
| 119 | int ldo = max8998_get_ldo(rdev); | 119 | int ldo = max8998_get_ldo(rdev); |
| 120 | int val; | 120 | int val; |
| 121 | 121 | ||
| 122 | if (ldo > ARRAY_SIZE(ldo_voltage_map)) | 122 | if (ldo >= ARRAY_SIZE(ldo_voltage_map)) |
| 123 | return -EINVAL; | 123 | return -EINVAL; |
| 124 | 124 | ||
| 125 | desc = ldo_voltage_map[ldo]; | 125 | desc = ldo_voltage_map[ldo]; |
| @@ -306,7 +306,7 @@ static int max8998_set_voltage(struct regulator_dev *rdev, | |||
| 306 | u8 val; | 306 | u8 val; |
| 307 | bool en_ramp = false; | 307 | bool en_ramp = false; |
| 308 | 308 | ||
| 309 | if (ldo > ARRAY_SIZE(ldo_voltage_map)) | 309 | if (ldo >= ARRAY_SIZE(ldo_voltage_map)) |
| 310 | return -EINVAL; | 310 | return -EINVAL; |
| 311 | 311 | ||
| 312 | desc = ldo_voltage_map[ldo]; | 312 | desc = ldo_voltage_map[ldo]; |
