On Thu, Oct 24, 2024 at 2:00 PM Klara Modin <klarasmodin@xxxxxxxxx> wrote: > > On 2024-10-24 13:45, Bartosz Golaszewski wrote: > > On Thu, 24 Oct 2024 13:34:11 +0200, Klara Modin <klarasmodin@xxxxxxxxx> said: > >> > >> I think I hit the same, or a similar bug, on my Edgerouter 6P (Cavium > >> Octeon III): > >> > >> CPU 3 Unable to handle kernel paging request at virtual address > >> 0000000000000000, epc == ffffffff817a40c8, ra == ffffffff817a40a4 > >> Oops[#1]: > >> CPU: 3 UID: 0 PID: 1 Comm: swapper/0 Not tainted > >> 6.12.0-rc4-next-20241023-00032-g01c8e35f8d89 #84 > >> ... > >> Call Trace: > >> gpiod_direction_output (drivers/gpio/gpiolib.c:4164 > >> drivers/gpio/gpiolib.c:2700 drivers/gpio/gpiolib.c:2694) > >> i2c_register_adapter (drivers/i2c/i2c-core-base.c:396 > >> drivers/i2c/i2c-core-base.c:422 drivers/i2c/i2c-core-base.c:434 > >> drivers/i2c/i2c-core-base.c:1574) > >> octeon_i2c_probe (drivers/i2c/busses/i2c-octeon-platdrv.c:247) > >> > >> (the complete log is attached) > >> > >> Unfortunately the oops remains after applying the diff and the call > >> trace looks to be the same. > >> > >> Please let me know if there's anything else you need. > >> > > > > Hmm so it's desc->gdev that is NULL... Could you try the following: > > > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > > index ae758ba6dc3d..c95c79ea2b49 100644 > > --- a/drivers/gpio/gpiolib.c > > +++ b/drivers/gpio/gpiolib.c > > @@ -1026,6 +1026,9 @@ int gpiochip_add_data_with_key(struct gpio_chip > > *gc, void *data, > > } > > } > > > > + for (desc_index = 0; desc_index < gc->ngpio; desc_index++) > > + gdev->descs[desc_index].gdev = gdev; > > + > > ATOMIC_INIT_NOTIFIER_HEAD(&gdev->line_state_notifier); > > BLOCKING_INIT_NOTIFIER_HEAD(&gdev->device_notifier); > > > > @@ -1055,8 +1058,6 @@ int gpiochip_add_data_with_key(struct gpio_chip > > *gc, void *data, > > for (desc_index = 0; desc_index < gc->ngpio; desc_index++) { > > struct gpio_desc *desc = &gdev->descs[desc_index]; > > > > - desc->gdev = gdev; > > - > > if (gc->get_direction && gpiochip_line_is_valid(gc, desc_index)) { > > assign_bit(FLAG_IS_OUT, > > &desc->flags, !gc->get_direction(gc, desc_index)); > > > > I'm wondering if this is not an earlier commit. > > > > Bart > > That doesn't seem to change anything significantly: > I managed to reproduce it by using optional GPIOs. I sent out a fix with both of you in Cc, please give it a try. Bart