ret = -EINVAL;
}
---- - /* Call set_voltage_time_sel if successfully obtained old_selector */
---- - if (ret == 0 && !rdev->constraints->ramp_disable && old_selector >= 0
---- - && old_selector != selector) {
++++ + if (ret)
++++ + goto out;
---- - delay = rdev->desc->ops->set_voltage_time_sel(rdev,
---- - old_selector, selector);
---- - if (delay < 0) {
---- - rdev_warn(rdev, "set_voltage_time_sel() failed: %d\n",
---- - delay);
---- - delay = 0;
++++ + if (ops->set_voltage_time_sel) {
++++ + /*
++++ + * Call set_voltage_time_sel if successfully obtained
++++ + * old_selector
++++ + */
++++ + if (old_selector >= 0 && old_selector != selector)
++++ + delay = ops->set_voltage_time_sel(rdev, old_selector,
++++ + selector);
++++ + } else {
++++ + if (old_uV != best_val) {
++++ + if (ops->set_voltage_time)
++++ + delay = ops->set_voltage_time(rdev, old_uV,
++++ + best_val);
++++ + else
++++ + delay = _regulator_set_voltage_time(rdev,
++++ + old_uV,
++++ + best_val);
}
++++ + }
---- - /* Insert any necessary delays */
---- - if (delay >= 1000) {
---- - mdelay(delay / 1000);
---- - udelay(delay % 1000);
---- - } else if (delay) {
---- - udelay(delay);
---- - }
++++ + if (delay < 0) {
++++ + rdev_warn(rdev, "failed to get delay: %d\n", delay);
++++ + delay = 0;
+ }
+
--- - if (ret == 0 && best_val >= 0) {
++++ + /* Insert any necessary delays */
++++ + if (delay >= 1000) {
++++ + mdelay(delay / 1000);
++++ + udelay(delay % 1000);
++++ + } else if (delay) {
++++ + udelay(delay);
+++ + }
+++ +
- if (ret == 0 && best_val >= 0) {
++++ + if (best_val >= 0) {
unsigned long data = best_val;
_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,