From: Jon Hunter Date: Thu, 21 Apr 2016 16:12:01 +0000 (+0100) Subject: regulator: helpers: Ensure bypass register field matches ON value X-Git-Tag: v4.14-rc1~3240^2~12^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd1a571daee7cdd6504a5771721e34f9b118f17a;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c index b1e32e74..bcf38fd 100644 --- a/drivers/regulator/helpers.c +++ b/drivers/regulator/helpers.c @@ -460,7 +460,7 @@ int regulator_get_bypass_regmap(struct regulator_dev *rdev, bool *enable) if (ret != 0) return ret; - *enable = val & rdev->desc->bypass_mask; + *enable = (val & rdev->desc->bypass_mask) == rdev->desc->bypass_val_on; return 0; }