diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-08-22 10:38:15 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-09-01 07:59:34 -0400 |
commit | 327531bada36e5786b13bb6918ad8afc545adfa2 (patch) | |
tree | 1ea5cb6f7d430a793eed7e2e5cf803f8cf16bb79 /drivers | |
parent | c356cbc2d4d99cf5a1429603fa1841e50987c4d3 (diff) |
regulator: tps6586x-regulator - fix value range checking for val
val is used as array index of ri->voltages.
Thus the valid value range should be 0 .. ri->desc.n_voltages - 1.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/regulator/tps6586x-regulator.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index 8cff1413a147..facd439d0f12 100644 --- a/drivers/regulator/tps6586x-regulator.c +++ b/drivers/regulator/tps6586x-regulator.c | |||
@@ -133,7 +133,7 @@ static int tps6586x_ldo_get_voltage(struct regulator_dev *rdev) | |||
133 | mask = ((1 << ri->volt_nbits) - 1) << ri->volt_shift; | 133 | mask = ((1 << ri->volt_nbits) - 1) << ri->volt_shift; |
134 | val = (val & mask) >> ri->volt_shift; | 134 | val = (val & mask) >> ri->volt_shift; |
135 | 135 | ||
136 | if (val > ri->desc.n_voltages) | 136 | if (val >= ri->desc.n_voltages) |
137 | BUG(); | 137 | BUG(); |
138 | 138 | ||
139 | return ri->voltages[val] * 1000; | 139 | return ri->voltages[val] * 1000; |