]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
2b5f71e4080c38119f46026290e12653fd049be3
[thirdparty/kernel/stable-queue.git] /
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
5
6 From: Axel Lin <axel.lin@gmail.com>
7
8 commit d4d6373c1109b11c8118340be97ae31b8f94d66a upstream.
9
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.
12
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>
16
17 ---
18 drivers/regulator/aat2870-regulator.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21 --- a/drivers/regulator/aat2870-regulator.c
22 +++ b/drivers/regulator/aat2870-regulator.c
23 @@ -159,7 +159,7 @@ static struct aat2870_regulator *aat2870
24 break;
25 }
26
27 - if (!ri)
28 + if (i == ARRAY_SIZE(aat2870_regulators))
29 return NULL;
30
31 ri->enable_addr = AAT2870_LDO_EN;