summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/helpers.c')
-rw-r--r--drivers/regulator/helpers.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c
index e4bb09bbd3fa..974f1a63993d 100644
--- a/drivers/regulator/helpers.c
+++ b/drivers/regulator/helpers.c
@@ -647,7 +647,8 @@ int regulator_list_voltage_table(struct regulator_dev *rdev,
return -EINVAL;
}
- if (selector >= rdev->desc->n_voltages)
+ if (selector >= rdev->desc->n_voltages ||
+ selector < rdev->desc->linear_min_sel)
return -EINVAL;
return rdev->desc->volt_table[selector];