From: Axel Lin Date: Thu, 7 Jun 2012 01:52:12 +0000 (+0800) Subject: regulator: core: Properly handle the case min_uV < rdev->desc->min_uV in map_voltage_... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0bdc81e4e944781a2bcc971f9e3cf24ac7030939;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git 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 Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 7584a74eec8..09a737c868b 100644 --- a/drivers/regulator/core.c +++ b/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;