Skip to content

Commit

Permalink
regulator: core: Check for failed voltage sets before checking for delay
Browse files Browse the repository at this point in the history
There is no need to consider waiting for the voltage to ramp if we
didn't manage to set it and looking at the return value is going to be
cheaper than is_enabled().

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Jun 26, 2012
1 parent 08aed2f commit 5aff3a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
best_val = _regulator_get_voltage(rdev);

/* Call set_voltage_time_sel if successfully obtained old_selector */
if (_regulator_is_enabled(rdev) && ret == 0 && old_selector >= 0 &&
if (ret == 0 && _regulator_is_enabled(rdev) && old_selector >= 0 &&
rdev->desc->ops->set_voltage_time_sel) {

delay = rdev->desc->ops->set_voltage_time_sel(rdev,
Expand Down

0 comments on commit 5aff3a8

Please sign in to comment.