It prints the line printf(", %d pins\n", sc->sc_npins);
That means, its not reaching the cannot establish interrupt error branch and going right to the sc->sc_gpio.gp_* lines. So I think I am passing wrong argument to the bus_space_map function, but not sure what is the wrong data. Sent from ProtonMail, Swiss-based encrypted email. ------- Original Message ------- On terça-feira, 29 de novembro de 2022 às 11:35 AM, Taylor R Campbell <riastr...@netbsd.org> wrote: > > Date: Tue, 29 Nov 2022 02:11:15 +0000 > > From: Bruno Melo bm...@protonmail.com > > > > and then the crash happens in my bus_space_unmap(). Please, do you > > have any idea what could be the problem or how i can investigate it? > > Picture attached and code below: > > > There's only one call to bus_space_unmap in your driver. It happens > here: > > printf(", %d pins\n", sc->sc_npins); > > > #if NGPIO > 0 > > config_found(sc->sc_dev, &gba, gpiobus_print, CFARGS_NONE); > > #endif > > unmap: > kmem_free(sc->sc_pin_ih, sc->sc_npins * sizeof(*sc->sc_pin_ih)); > > bus_space_unmap(sc->sc_memt, sc->sc_memh, sc->sc_size); > > sc->sc_size = 0; > > printf(" DOIS"); > > There are two ways to reach this: > > 1. The error branch when acpi_intr_establish fails, which will first > print a message (`can't establish interrupt') so you can tell > whether this happened. > > 2. Fall through after config_found. This is the case where everything > succeeded, so you probably meant to return here instead of falling > through to cleanup!