linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: core: simplify return value on suported_voltage
@ 2019-04-22 17:28 Jorge Ramirez-Ortiz
  2019-04-22 17:28 ` Jorge Ramirez-Ortiz
  2019-05-03  6:39 ` Applied "regulator: core: simplify return value on suported_voltage" to the regulator tree Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-04-22 17:28 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, lgirdwood, broonie
  Cc: linux-kernel, linux-arm-msm, bjorn.andersson

All the current clients of this API  assume that 0 corresponds
to a failure and non-zero to a pass therefore ignoring the need to
handle a negative error code.

This commit modifies the API to follow that standard since returning a
negative (EINVAL) doesn't seem to provide enough value to justify
the need to handle it.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 drivers/regulator/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 186a37675b50..d872dfe75b63 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3002,7 +3002,7 @@ EXPORT_SYMBOL_GPL(regulator_get_linear_step);
  * @min_uV: Minimum required voltage in uV.
  * @max_uV: Maximum required voltage in uV.
  *
- * Returns a boolean or a negative error code.
+ * Returns a boolean.
  */
 int regulator_is_supported_voltage(struct regulator *regulator,
 				   int min_uV, int max_uV)
@@ -3026,7 +3026,7 @@ int regulator_is_supported_voltage(struct regulator *regulator,
 
 	ret = regulator_count_voltages(regulator);
 	if (ret < 0)
-		return ret;
+		return 0;
 	voltages = ret;
 
 	for (i = 0; i < voltages; i++) {
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-03  6:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-22 17:28 [PATCH] regulator: core: simplify return value on suported_voltage Jorge Ramirez-Ortiz
2019-04-22 17:28 ` Jorge Ramirez-Ortiz
2019-05-03  6:39 ` Applied "regulator: core: simplify return value on suported_voltage" to the regulator tree Mark Brown
2019-05-03  6:39   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).