From: Marek Szyprowski Date: Tue, 13 Nov 2012 08:48:51 +0000 (+0100) Subject: regulator: fix voltage check in regulator_is_supported_voltage() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f0f98b19e23d4426ca185e3d4ca80e6aff5ef51b;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git regulator: fix voltage check in regulator_is_supported_voltage() regulator_is_supported_voltage() should return true only if the voltage of fixed/constant regulator is between min_uV and max_uV. Signed-off-by: Marek Szyprowski Signed-off-by: Mark Brown Cc: stable@vger.kernel.org --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 5c4829cba6a6..27eb9d66f06a 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1974,7 +1974,7 @@ int regulator_is_supported_voltage(struct regulator *regulator, if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) { ret = regulator_get_voltage(regulator); if (ret >= 0) - return (min_uV >= ret && ret <= max_uV); + return (min_uV <= ret && ret <= max_uV); else return ret; }