summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/88pm8607.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-08-04 16:18:11 +0800
committerLiam Girdwood <lrg@slimlogic.co.uk>2011-08-08 17:15:08 +0100
commit99cd25ce10249c7f9d7172fe2ed266b023cd3323 (patch)
treea3a966425ec2661cf94661f68691f6207c303c67 /drivers/regulator/88pm8607.c
parent88585b83e011e661bcd2cf48d47f4634bdd92a14 (diff)
downloadlinux-99cd25ce10249c7f9d7172fe2ed266b023cd3323.tar.bz2
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/88pm8607.c')
-rw-r--r--drivers/regulator/88pm8607.c2
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)
if (info->desc.id == res->start)
break;
}
- if ((i < 0) || (i > PM8607_ID_RG_MAX)) {
+ if (i == ARRAY_SIZE(pm8607_regulator_info)) {
dev_err(&pdev->dev, "Failed to find regulator %llu\n",
(unsigned long long)res->start);
return -EINVAL;