Browse Source

regulator: core: Properly handle the case min_uV < rdev->desc->min_uV in map_voltage_linear

Properly handle the case if the specified min_uV is less than the voltage given
by the lowest selector.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin 13 years ago
parent
commit
0bdc81e4e9
1 changed files with 3 additions and 0 deletions
  1. 3 0
      drivers/regulator/core.c

+ 3 - 0
drivers/regulator/core.c

@@ -2050,6 +2050,9 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev,
 		return -EINVAL;
 	}
 
+	if (min_uV < rdev->desc->min_uV)
+		min_uV = rdev->desc->min_uV;
+
 	ret = DIV_ROUND_UP(min_uV - rdev->desc->min_uV, rdev->desc->uV_step);
 	if (ret < 0)
 		return ret;