diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-08-04 04:18:11 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-08-08 12:15:08 -0400 |
commit | 99cd25ce10249c7f9d7172fe2ed266b023cd3323 (patch) | |
tree | a3a966425ec2661cf94661f68691f6207c303c67 /drivers/regulator | |
parent | 88585b83e011e661bcd2cf48d47f4634bdd92a14 (diff) |
regulator: 88pm8607: Fix off-by-one value range checking in the case of no id is matched
In the case of no id is matched, the variable i is equal to
ARRAY_SIZE(pm8607_regulator_info).
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/regulator')
-rw-r--r-- | drivers/regulator/88pm8607.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index d63fddb0fbb0..e821b2159b4b 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c | |||
@@ -412,7 +412,7 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev) | |||
412 | if (info->desc.id == res->start) | 412 | if (info->desc.id == res->start) |
413 | break; | 413 | break; |
414 | } | 414 | } |
415 | if ((i < 0) || (i > PM8607_ID_RG_MAX)) { | 415 | if (i == ARRAY_SIZE(pm8607_regulator_info)) { |
416 | dev_err(&pdev->dev, "Failed to find regulator %llu\n", | 416 | dev_err(&pdev->dev, "Failed to find regulator %llu\n", |
417 | (unsigned long long)res->start); | 417 | (unsigned long long)res->start); |
418 | return -EINVAL; | 418 | return -EINVAL; |