]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
regulator: Fix the logic to ensure new voltage setting in valid range
authorAxel Lin <axel.lin@gmail.com>
Wed, 11 Apr 2012 12:53:58 +0000 (20:53 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 17 Apr 2012 14:17:11 +0000 (15:17 +0100)
I think this is a typo.
To ensure new voltage setting won't greater than desc->max,
the equation should be desc->min + desc->step * new_val <= desc->max.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
drivers/regulator/max8997.c

index 96579296f04d91aaf2859288f6e34ae806e901e4..17a58c56eebfb4f0c7978afa9b04d2307ccc342e 100644 (file)
@@ -684,7 +684,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
                }
 
                new_val++;
-       } while (desc->min + desc->step + new_val <= desc->max);
+       } while (desc->min + desc->step * new_val <= desc->max);
 
        new_idx = tmp_idx;
        new_val = tmp_val;