Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: helpers: Ensure bypass register field matches ON value

When checking bypass state for a regulator, we check to see if any bits
in the bypass mask are set. For most cases this is fine because there is
typically, only a single bit used to determine if the regulator is in
bypass. However, for some regulators, such as LDO6 on AS3722, the bypass
state is indicate by a value rather than a single bit. Therefore, when
checking the bypass state, check that the bypass field matches the ON
value.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jon Hunter and committed by
Mark Brown
dd1a571d f55532a0

+1 -1
+1 -1
drivers/regulator/helpers.c
··· 460 460 if (ret != 0) 461 461 return ret; 462 462 463 - *enable = val & rdev->desc->bypass_mask; 463 + *enable = (val & rdev->desc->bypass_mask) == rdev->desc->bypass_val_on; 464 464 465 465 return 0; 466 466 }