From: Axel Lin Date: Fri, 8 Jun 2012 07:39:34 +0000 (+0800) Subject: regulator: mc13xxx: Fix voltage checking for mc13xxx_fixed_regulator_set_voltage X-Git-Tag: firefly_0821_release~3680^2~2413^2^2~101 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=ee5e6253ac22210da892435711890fa2272daa41;p=firefly-linux-kernel-4.4.55.git regulator: mc13xxx: Fix voltage checking for mc13xxx_fixed_regulator_set_voltage The voltage range checking should be to ensure mc13xxx_regulators[id].voltages[0] falls with min_uV and max_uV. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c index 4fa9704739bc..3e191715fb25 100644 --- a/drivers/regulator/mc13xxx-regulator-core.c +++ b/drivers/regulator/mc13xxx-regulator-core.c @@ -158,8 +158,8 @@ int mc13xxx_fixed_regulator_set_voltage(struct regulator_dev *rdev, int min_uV, dev_dbg(rdev_get_dev(rdev), "%s id: %d min_uV: %d max_uV: %d\n", __func__, id, min_uV, max_uV); - if (min_uV >= mc13xxx_regulators[id].voltages[0] && - max_uV <= mc13xxx_regulators[id].voltages[0]) + if (min_uV <= mc13xxx_regulators[id].voltages[0] && + mc13xxx_regulators[id].voltages[0] <= max_uV) return 0; else return -EINVAL;