Skip to content

Commit

Permalink
regulator: core: Properly handle the case min_uV < rdev->desc->min_uV…
Browse files Browse the repository at this point in the history
… 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 <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
AxelLin authored and broonie committed Jun 7, 2012
1 parent 6166317 commit 0bdc81e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0bdc81e

Please sign in to comment.