Skip to content

Commit

Permalink
regulator: aat2870: Fix the logic of checking if no id is matched in …
Browse files Browse the repository at this point in the history
…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 <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
  • Loading branch information
Axel Lin authored and Mark Brown committed Nov 28, 2011
1 parent caca6a0 commit d4d6373
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/aat2870-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,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;
Expand Down

0 comments on commit d4d6373

Please sign in to comment.