Skip to contentSkip to conversation

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

PATCH New Axel Lin 1 participant 1 message Jun 7, 2012 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/regulator/core.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/regulator/core.c +3 -0
index 3cbe312..02c1940 100644
@@ -2075,6 +2075,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;
Signature · 1 line
1.7.9.5