diff options
-rw-r--r-- | drivers/regulator/core.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 58452ac0f165..7287000595e5 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -2097,16 +2097,26 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load) | |||
2097 | 2097 | ||
2098 | mutex_lock(&rdev->mutex); | 2098 | mutex_lock(&rdev->mutex); |
2099 | 2099 | ||
2100 | /* | ||
2101 | * first check to see if we can set modes at all, otherwise just | ||
2102 | * tell the consumer everything is OK. | ||
2103 | */ | ||
2100 | regulator->uA_load = uA_load; | 2104 | regulator->uA_load = uA_load; |
2101 | ret = regulator_check_drms(rdev); | 2105 | ret = regulator_check_drms(rdev); |
2102 | if (ret < 0) | 2106 | if (ret < 0) { |
2107 | ret = 0; | ||
2103 | goto out; | 2108 | goto out; |
2104 | ret = -EINVAL; | 2109 | } |
2105 | 2110 | ||
2106 | /* sanity check */ | ||
2107 | if (!rdev->desc->ops->get_optimum_mode) | 2111 | if (!rdev->desc->ops->get_optimum_mode) |
2108 | goto out; | 2112 | goto out; |
2109 | 2113 | ||
2114 | /* | ||
2115 | * we can actually do this so any errors are indicators of | ||
2116 | * potential real failure. | ||
2117 | */ | ||
2118 | ret = -EINVAL; | ||
2119 | |||
2110 | /* get output voltage */ | 2120 | /* get output voltage */ |
2111 | output_uV = _regulator_get_voltage(rdev); | 2121 | output_uV = _regulator_get_voltage(rdev); |
2112 | if (output_uV <= 0) { | 2122 | if (output_uV <= 0) { |