Skip to content

Commit

Permalink
regulator: fix voltage check in regulator_is_supported_voltage()
Browse files Browse the repository at this point in the history
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 <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
  • Loading branch information
Marek Szyprowski authored and Mark Brown committed Nov 15, 2012
1 parent 77b6706 commit f0f98b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f0f98b1

Please sign in to comment.