diff mbox series

regulator: Fix return value of _set_load() stub

Message ID 20181117031930.24011-1-broonie@kernel.org
State Accepted
Commit f1abf67217de91f5cd3c757ae857632ca565099a
Headers show
Series regulator: Fix return value of _set_load() stub | expand

Commit Message

Mark Brown Nov. 17, 2018, 3:19 a.m. UTC
The stub implementation of _set_load() returns a mode value which is
within the bounds of valid return codes for success (the documentation
just says that failures are negative error codes) but not sensible or
what the actual implementation does.  Fix it to just return 0.

Reported-by: Cheng-Yi Chiang <cychiang@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>

---
 include/linux/regulator/consumer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.19.1

Comments

Doug Anderson Nov. 19, 2018, 5:23 p.m. UTC | #1
Hi,

On Fri, Nov 16, 2018 at 7:21 PM Mark Brown <broonie@kernel.org> wrote:
>

> The stub implementation of _set_load() returns a mode value which is

> within the bounds of valid return codes for success (the documentation

> just says that failures are negative error codes) but not sensible or

> what the actual implementation does.  Fix it to just return 0.

>

> Reported-by: Cheng-Yi Chiang <cychiang@chromium.org>

> Signed-off-by: Mark Brown <broonie@kernel.org>

> ---

>  include/linux/regulator/consumer.h | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)


I had the same patch in my queue to send up.  Note that the
documentation of the function was changed in commit e39ce48f5362
("regulator: Rename regulator_set_optimum_mode") though that patch
didn't actually change the code in any significant way so presumably
the bug is from even before that.

Reviewed-by: Douglas Anderson <dianders@chromium.org>
diff mbox series

Patch

diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 25602afd4844..f3f76051e8b0 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -508,7 +508,7 @@  static inline int regulator_get_error_flags(struct regulator *regulator,
 
 static inline int regulator_set_load(struct regulator *regulator, int load_uA)
 {
-	return REGULATOR_MODE_NORMAL;
+	return 0;
 }
 
 static inline int regulator_allow_bypass(struct regulator *regulator,