Linux Power Management development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Dzmitry Sankouski <dsankouski@gmail.com>
Cc: Sebastian Reichel <sre@kernel.org>, Lee Jones <lee@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] power: supply: max77705: Fix error code in max77705_get_health()
Date: Fri, 21 Mar 2025 17:34:11 +0300	[thread overview]
Message-ID: <0ea50e87-2b63-4062-8c2a-17537495f481@stanley.mountain> (raw)
In-Reply-To: <94f55158-1776-4f2f-9296-e307e83d569a@stanley.mountain>

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@linaro.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;
 	}
 	return max77705_get_battery_health(charger, val);
 }
-- 
2.47.2


  parent reply	other threads:[~2025-03-21 14:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 14:34 [PATCH 0/2] power: supply: max77705: Fix two static checker issues Dan Carpenter
2025-03-21 14:34 ` [PATCH 1/2] power: supply: max77705: Fix workqueue error handling in probe Dan Carpenter
2025-03-22 16:48   ` Krzysztof Kozlowski
2025-03-21 14:34 ` Dan Carpenter [this message]
2025-03-26 17:14   ` [PATCH 2/2] power: supply: max77705: Fix error code in max77705_get_health() Krzysztof Kozlowski
2025-03-26 17:27     ` Dan Carpenter
2025-04-28 22:18 ` (subset) [PATCH 0/2] power: supply: max77705: Fix two static checker issues Sebastian Reichel
2025-04-28 23:30   ` Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0ea50e87-2b63-4062-8c2a-17537495f481@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=dsankouski@gmail.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox