From: Ruoyu Wang Date: Sat, 20 Jun 2026 15:53:19 +0000 (+0800) Subject: gpiolib: initialize return value in gpiochip_set_multiple() X-Git-Tag: v7.2-rc1~33^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=99dfa46baba29513d1094c8f30bc86c6ef88543a;p=thirdparty%2Flinux.git gpiolib: initialize return value in gpiochip_set_multiple() gpiochip_set_multiple() falls back to setting lines one by one when the chip does not provide set_multiple(). If the fallback path receives an empty mask, the loop is skipped and ret is returned without being initialized. Initialize ret to 0 so an empty mask is treated as a successful no-op. Fixes: 9b407312755f ("gpiolib: rework the wrapper around gpio_chip::set_multiple()") Signed-off-by: Ruoyu Wang Acked-by: Uwe Kleine-König Link: https://patch.msgid.link/20260620155319.79994-1-ruoyuw560@gmail.com Signed-off-by: Bartosz Golaszewski --- diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 8a5ff78a11490..e5fb60111151f 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -3803,7 +3803,7 @@ static int gpiochip_set_multiple(struct gpio_chip *gc, unsigned long *mask, unsigned long *bits) { unsigned int i; - int ret; + int ret = 0; lockdep_assert_held(&gc->gpiodev->srcu);