Skip to content

Commit

Permalink
regulator: Set delay to 0 if set_voltage_time_sel callback returns error
Browse files Browse the repository at this point in the history
rdev->desc->ops->set_voltage_time_sel may return negative error code.
Set delay to 0 and also show warning if set_voltage_time_sel returns error.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Axel Lin authored and Mark Brown committed Feb 24, 2012
1 parent 2475143 commit 0735123
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1836,8 +1836,12 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
if (ret < 0)
return ret;
old_selector = ret;
delay = rdev->desc->ops->set_voltage_time_sel(rdev,
ret = rdev->desc->ops->set_voltage_time_sel(rdev,
old_selector, selector);
if (ret < 0)
rdev_warn(rdev, "set_voltage_time_sel() failed: %d\n", ret);
else
delay = ret;
}

if (best_val != INT_MAX) {
Expand Down

0 comments on commit 0735123

Please sign in to comment.