]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: mmio: don't use legacy GPIO chip setters
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 18 Jun 2025 13:02:07 +0000 (15:02 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 19 Jun 2025 07:13:44 +0000 (09:13 +0200)
We've converted this driver to using the new GPIO line value setters but
missed the instances where the legacy callback is accessed directly using
the function pointer. This will lead to a NULL-pointer dereference as
this pointer is no longer populated. The issue needs fixing locally as
well as in the already converted previously users of gpio-mmio.

Fixes: b908d35d0003 ("gpio: mmio: use new GPIO line value setter callbacks")
Reported-by: Klara Modin <klarasmodin@gmail.com>
Closes: https://lore.kernel.org/all/2rw2sncevdiyirpdovotztlg77apcq2btzytuv5jnm55aqhlne@swtts3hl53tw/
Tested-by: Klara Modin <klarasmodin@gmail.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20250618-gpio-mmio-fix-setter-v1-2-2578ffb77019@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-74xx-mmio.c
drivers/gpio/gpio-en7523.c
drivers/gpio/gpio-mmio.c

index c7ac5a9ffb1fd1cc9439e3320d54574bf0cebbf6..3ba21add3a1c669171578ceaf9cc1728c060d401 100644 (file)
@@ -100,7 +100,7 @@ static int mmio_74xx_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
        struct mmio_74xx_gpio_priv *priv = gpiochip_get_data(gc);
 
        if (priv->flags & MMIO_74XX_DIR_OUT) {
-               gc->set(gc, gpio, val);
+               gc->set_rv(gc, gpio, val);
                return 0;
        }
 
index 69834db2c1cf26be379c0deca38dda889202f706..c08069d0d1045e9df4a76cad4600bf25d4e3a7c5 100644 (file)
@@ -50,7 +50,7 @@ static int airoha_dir_set(struct gpio_chip *gc, unsigned int gpio,
        iowrite32(dir, ctrl->dir[gpio / 16]);
 
        if (out)
-               gc->set(gc, gpio, val);
+               gc->set_rv(gc, gpio, val);
 
        iowrite32(output, ctrl->output);
 
index 4d999f358cc4985b5c0cce8b2c4f118adcf96e05..08466e123818e958755fe6e7baf5a4e8b8d863c1 100644 (file)
@@ -367,7 +367,7 @@ static int bgpio_dir_out_err(struct gpio_chip *gc, unsigned int gpio,
 static int bgpio_simple_dir_out(struct gpio_chip *gc, unsigned int gpio,
                                int val)
 {
-       gc->set(gc, gpio, val);
+       gc->set_rv(gc, gpio, val);
 
        return bgpio_dir_return(gc, gpio, true);
 }
@@ -432,14 +432,14 @@ static int bgpio_dir_out_dir_first(struct gpio_chip *gc, unsigned int gpio,
                                   int val)
 {
        bgpio_dir_out(gc, gpio, val);
-       gc->set(gc, gpio, val);
+       gc->set_rv(gc, gpio, val);
        return bgpio_dir_return(gc, gpio, true);
 }
 
 static int bgpio_dir_out_val_first(struct gpio_chip *gc, unsigned int gpio,
                                   int val)
 {
-       gc->set(gc, gpio, val);
+       gc->set_rv(gc, gpio, val);
        bgpio_dir_out(gc, gpio, val);
        return bgpio_dir_return(gc, gpio, true);
 }