drivers/power/supply/sbs-manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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
On Wed, 18 Feb 2026 12:59:49 -0800, Dmitry Torokhov wrote:
> 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.
>
>
Applied, thanks!
[1/1] power: supply: sbs-manager: normalize return value of gpio_get
commit: b4512ae0d55a5632294a16eae765e8b4c41b8856
Best regards,
--
Sebastian Reichel <sebastian.reichel@collabora.com>
On Wed, Feb 18, 2026 at 9:59 PM Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > 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> Reviewed-by: Linus Walleij <linusw@kernel.org> Yours, Linus Walleij
On Wed, 18 Feb 2026 21:59:49 +0100, Dmitry Torokhov <dmitry.torokhov@gmail.com> said: > 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 > Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
© 2016 - 2026 Red Hat, Inc.