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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c
index 974f1a63993d..f42b394a0c46 100644
--- a/drivers/regulator/helpers.c
+++ b/drivers/regulator/helpers.c
@@ -647,9 +647,10 @@ int regulator_list_voltage_table(struct regulator_dev *rdev,
return -EINVAL;
}
- if (selector >= rdev->desc->n_voltages ||
- selector < rdev->desc->linear_min_sel)
+ if (selector >= rdev->desc->n_voltages)
return -EINVAL;
+ if (selector < rdev->desc->linear_min_sel)
+ return 0;
return rdev->desc->volt_table[selector];
}