summaryrefslogtreecommitdiff
path: root/drivers/regulator/aat2870-regulator.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-11-28 10:06:31 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-28 15:48:15 +0400
commitd4d6373c1109b11c8118340be97ae31b8f94d66a (patch)
tree046e924ca1ea4c65aec700f7a42eb0477f3fb990 /drivers/regulator/aat2870-regulator.c
parentcaca6a03d365883564885f2c1da3e88dcf65d139 (diff)
downloadlinux-d4d6373c1109b11c8118340be97ae31b8f94d66a.tar.xz
regulator: aat2870: Fix the logic of checking if no id is matched in aat2870_get_regulator
In current implementation, the pointer ri is not NULL if no id is matched. Fix it by checking i == ARRAY_SIZE(aat2870_regulators) if no id is matched. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@kernel.org
Diffstat (limited to 'drivers/regulator/aat2870-regulator.c')
-rw-r--r--drivers/regulator/aat2870-regulator.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/aat2870-regulator.c b/drivers/regulator/aat2870-regulator.c
index 5abeb3ac3e8d..298c6c6a2795 100644
--- a/drivers/regulator/aat2870-regulator.c
+++ b/drivers/regulator/aat2870-regulator.c
@@ -160,7 +160,7 @@ static struct aat2870_regulator *aat2870_get_regulator(int id)
break;
}
- if (!ri)
+ if (i == ARRAY_SIZE(aat2870_regulators))
return NULL;
ri->enable_addr = AAT2870_LDO_EN;