1 From d4d6373c1109b11c8118340be97ae31b8f94d66a Mon Sep 17 00:00:00 2001
2 From: Axel Lin <axel.lin@gmail.com>
3 Date: Mon, 28 Nov 2011 14:06:31 +0800
4 Subject: regulator: aat2870: Fix the logic of checking if no id is matched in aat2870_get_regulator
6 From: Axel Lin <axel.lin@gmail.com>
8 commit d4d6373c1109b11c8118340be97ae31b8f94d66a upstream.
10 In current implementation, the pointer ri is not NULL if no id is matched.
11 Fix it by checking i == ARRAY_SIZE(aat2870_regulators) if no id is matched.
13 Signed-off-by: Axel Lin <axel.lin@gmail.com>
14 Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
18 drivers/regulator/aat2870-regulator.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
21 --- a/drivers/regulator/aat2870-regulator.c
22 +++ b/drivers/regulator/aat2870-regulator.c
23 @@ -159,7 +159,7 @@ static struct aat2870_regulator *aat2870
28 + if (i == ARRAY_SIZE(aat2870_regulators))
31 ri->enable_addr = AAT2870_LDO_EN;