lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <658c41d0-734b-4397-9687-80b6a219c61c@linaro.org>
Date: Wed, 26 Mar 2025 18:14:13 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Dan Carpenter <dan.carpenter@...aro.org>,
 Dzmitry Sankouski <dsankouski@...il.com>
Cc: Sebastian Reichel <sre@...nel.org>, Lee Jones <lee@...nel.org>,
 linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] power: supply: max77705: Fix error code in
 max77705_get_health()

On 21/03/2025 15:34, Dan Carpenter wrote:
> Return -EINVAL if the health is bad.  Don't return success.
> 
> Fixes: a6a494c8e3ce ("power: supply: max77705: Add charger driver for Maxim 77705")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
>  drivers/power/supply/max77705_charger.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/max77705_charger.c b/drivers/power/supply/max77705_charger.c
> index 329b430d0e50..0e347353c41e 100644
> --- a/drivers/power/supply/max77705_charger.c
> +++ b/drivers/power/supply/max77705_charger.c
> @@ -285,7 +285,7 @@ static int max77705_get_health(struct max77705_charger_data *charger, int *val)
>  	if (is_online) {
>  		ret = max77705_get_vbus_state(regmap, val);
>  		if (ret || (*val != POWER_SUPPLY_HEALTH_GOOD))
> -			return ret;
> +			return -EINVAL;


I don't think this is right. First, your commit msg should mention why
returning -EINVAL in such case.

Second, if get_vbus_state succeeded, but 'val' is not good (e.g.
overvoltage), the callback is supposed to return 0 as success of
retrieving the data, no? So the user-space can read 'val' and figure out
whatever it needs to figure out (overvoltage).

The EINVAL is when the data could not be read, thus user-space should
ignore 'val'.


Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ