Commit 13e15d58 authored by Axel Lin's avatar Axel Lin Committed by Greg Kroah-Hartman

regulator: aat2870: Fix the logic of checking if no id is matched in aat2870_get_regulator

commit d4d6373c 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: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 41480113
......@@ -159,7 +159,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment