From: Jorge Ramirez-Ortiz Date: Mon, 22 Apr 2019 17:28:24 +0000 (+0200) Subject: regulator: core: simplify return value on suported_voltage X-Git-Tag: v5.2-rc1~174^2^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=498209445124920b365ef43aac93d6f1acbaa1b7;p=thirdparty%2Fkernel%2Flinux.git regulator: core: simplify return value on suported_voltage 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 Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 08ccabe07fe35..af8b4dadb09bf 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++) {