Skip to content

Commit d4d6373

Browse files
AxelLinbroonie
authored andcommitted
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 <[email protected]> Signed-off-by: Mark Brown <[email protected]> Cc: [email protected]
1 parent caca6a0 commit d4d6373

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/regulator/aat2870-regulator.c

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

163-
if (!ri)
163+
if (i == ARRAY_SIZE(aat2870_regulators))
164164
return NULL;
165165

166166
ri->enable_addr = AAT2870_LDO_EN;

0 commit comments

Comments
 (0)