Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4d6373c authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

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: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
parent caca6a03
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;