From: Dmitry Torokhov Date: Wed, 18 Feb 2026 19:06:54 +0000 (-0800) Subject: gpio: stp-xway: normalize return value of gpio_get X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e62b94a690c8cd7050c3d308e01ee1b24ee9bb0b;p=thirdparty%2Fkernel%2Flinux.git gpio: stp-xway: normalize return value of gpio_get The GPIO get callback is expected to return 0 or 1 (or a negative error code). Ensure that the value returned by xway_stp_get() is normalized to the [0, 1] range. Signed-off-by: Dmitry Torokhov Link: https://patch.msgid.link/20260218190657.2974723-5-dmitry.torokhov@gmail.com Signed-off-by: Bartosz Golaszewski --- diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c index 493c027afdd62..78d6c78d4aab5 100644 --- a/drivers/gpio/gpio-stp-xway.c +++ b/drivers/gpio/gpio-stp-xway.c @@ -102,7 +102,7 @@ static int xway_stp_get(struct gpio_chip *gc, unsigned int gpio) { struct xway_stp *chip = gpiochip_get_data(gc); - return (xway_stp_r32(chip->virt, XWAY_STP_CPU0) & BIT(gpio)); + return !!(xway_stp_r32(chip->virt, XWAY_STP_CPU0) & BIT(gpio)); } /**