Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: fix calculation of voltage range in da9034_set_ldo12_voltage()

For val to be greater than 7 or less than 20 is logically always true.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>

authored by

Roel Kluin and committed by
Liam Girdwood
656d0498 77bb8ff9

+1 -1
+1 -1
drivers/regulator/da903x.c
··· 301 301 } 302 302 303 303 val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV; 304 - val = (val > 7 || val < 20) ? 8 : val - 12; 304 + val = (val > 7 && val < 20) ? 8 : val - 12; 305 305 val <<= info->vol_shift; 306 306 mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; 307 307