OSDN Git Service

regulator: core: simplify return value on suported_voltage
authorJorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Mon, 22 Apr 2019 17:28:24 +0000 (19:28 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 3 May 2019 06:34:26 +0000 (15:34 +0900)
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/core.c

index 08ccabe..af8b4da 100644 (file)
@@ -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++) {