tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Porting amdgpio driver from OpenBSD



> Date: Tue, 29 Nov 2022 02:11:15 +0000
> From: Bruno Melo <bmelo%protonmail.com@localhost>
> 
> 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!


Home | Main Index | Thread Index | Old Index