aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-09-04 11:06:41 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-09-05 06:15:52 -0400
commit49990e6efe576b8707584398f93198b5aa182ab7 (patch)
treee2ad8126f0d930d314fb6f771c87ab4f96977924 /drivers
parentd06563cb860ab594889010889a7111c9e25d1051 (diff)
regulator: ab8500 - fix off-by-one value range checking for selector
selector is used as array index of info->supported_voltages Thus the valid value range should be 0 .. info->voltages_len -1 Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Mark Brown <broonie@openource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/ab8500.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index 3d09580dc883..28c7ae67cec9 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -157,7 +157,7 @@ static int ab8500_list_voltage(struct regulator_dev *rdev, unsigned selector)
157 if (info->fixed_uV) 157 if (info->fixed_uV)
158 return info->fixed_uV; 158 return info->fixed_uV;
159 159
160 if (selector > info->voltages_len) 160 if (selector >= info->voltages_len)
161 return -EINVAL; 161 return -EINVAL;
162 162
163 return info->supported_voltages[selector]; 163 return info->supported_voltages[selector];