summaryrefslogtreecommitdiff
path: root/drivers/regulator/rc5t583-regulator.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-04-04 22:38:09 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-05 11:02:44 +0100
commit9cc7a453b637d8c1f628f9873204ff55d7aa664c (patch)
treea1df0bf9a5828e1f72ff4e03b053d88b6f7cbf21 /drivers/regulator/rc5t583-regulator.c
parent7eb6444fc33bfe7bcd05533de86a1dc4e1852d71 (diff)
regulator: rc5t583: Fix off-by-one valid range checking for selector
The valid selector should be 0 ... nsteps-1. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/rc5t583-regulator.c')
-rw-r--r--drivers/regulator/rc5t583-regulator.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/rc5t583-regulator.c b/drivers/regulator/rc5t583-regulator.c
index cac8a2a4f8e6..dc9ebb9bfd23 100644
--- a/drivers/regulator/rc5t583-regulator.c
+++ b/drivers/regulator/rc5t583-regulator.c
@@ -131,7 +131,7 @@ static int rc5t583_set_voltage_sel(struct regulator_dev *rdev,
struct rc5t583_regulator *reg = rdev_get_drvdata(rdev);
struct rc5t583_regulator_info *ri = reg->reg_info;
int ret;
- if (selector > ri->nsteps) {
+ if (selector >= ri->nsteps) {
dev_err(&rdev->dev, "Invalid selector 0x%02x\n", selector);
return -EINVAL;
}