diff options
-rw-r--r-- | drivers/regulator/core.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 9493f6111a38..d3e38790906e 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1886,12 +1886,14 @@ static int _regulator_get_voltage(struct regulator_dev *rdev) if (sel < 0) return sel; ret = rdev->desc->ops->list_voltage(rdev, sel); - } - if (rdev->desc->ops->get_voltage) + } else if (rdev->desc->ops->get_voltage) { ret = rdev->desc->ops->get_voltage(rdev); - else + } else { return -EINVAL; + } + if (ret < 0) + return ret; return ret - rdev->constraints->uV_offset; } |