public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: supply: sbs-manager: normalize return value of gpio_get
@ 2026-02-18 20:59 Dmitry Torokhov
  2026-02-19 10:42 ` Bartosz Golaszewski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2026-02-18 20:59 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Linus Walleij, Bartosz Golaszewski, Xichao Zhao, Baolin Wang,
	AngeloGioacchino Del Regno, linux-pm, linux-kernel, linux-gpio

The GPIO get callback is expected to return 0 or 1 (or a negative error
code). Ensure that the value returned by sbsm_gpio_get_value() is
normalized to the [0, 1] range.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/power/supply/sbs-manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/sbs-manager.c b/drivers/power/supply/sbs-manager.c
index 6fe526222f7f..343ad4ab4082 100644
--- a/drivers/power/supply/sbs-manager.c
+++ b/drivers/power/supply/sbs-manager.c
@@ -199,7 +199,7 @@ static int sbsm_gpio_get_value(struct gpio_chip *gc, unsigned int off)
 	if (ret < 0)
 		return ret;
 
-	return ret & BIT(off);
+	return !!(ret & BIT(off));
 }
 
 /*
-- 
2.53.0.335.g19a08e0c02-goog


-- 
Dmitry

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

end of thread, other threads:[~2026-03-02 23:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 20:59 [PATCH] power: supply: sbs-manager: normalize return value of gpio_get Dmitry Torokhov
2026-02-19 10:42 ` Bartosz Golaszewski
2026-02-19 17:25 ` Linus Walleij
2026-03-02 23:41 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox