Skip to content

Commit 13e15d5

Browse files
AxelLingregkh
authored andcommitted
regulator: aat2870: Fix the logic of checking if no id is matched in aat2870_get_regulator
commit d4d6373 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 4148011 commit 13e15d5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/regulator/aat2870-regulator.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static struct aat2870_regulator *aat2870_get_regulator(int id)
159159
break;
160160
}
161161

162-
if (!ri)
162+
if (i == ARRAY_SIZE(aat2870_regulators))
163163
return NULL;
164164

165165
ri->enable_addr = AAT2870_LDO_EN;

0 commit comments

Comments
 (0)