Re: [PATCH 01/12] gpio: mmio: use new GPIO line value setter callbacks

From: Bartosz Golaszewski
Date: Wed Jun 18 2025 - 13:00:45 EST


On Wed, Jun 18, 2025 at 6:43 PM Marek Szyprowski
<m.szyprowski@xxxxxxxxxxx> wrote:
>
> A few more changes are needed to avoid NULL pointer dereference
> (observed on RasbperrryPi5), because this driver calls ->set method
> internally:
>
> diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c
> index 9169eccadb23..57622f45d33e 100644
> --- a/drivers/gpio/gpio-mmio.c
> +++ b/drivers/gpio/gpio-mmio.c
> @@ -362,7 +362,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);
> }
> @@ -427,14 +427,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);
> }
>
> Do You want a formal patch with the above changes, or will You just
> amend them to the updated patch?
>

Thanks, a patch[1] is already up for review. Please give it a try and
leave your Tested-by: if you can.

Bartosz

[1] https://lore.kernel.org/all/20250618-gpio-mmio-fix-setter-v1-2-2578ffb77019@xxxxxxxxxx/