Move the KASSERT() check to the point before the increase of number of pins.
Approved by: adrian (mentor)
This commit is contained in:
parent
8ad579cac3
commit
a1f621566e
@ -190,13 +190,13 @@ gpiobus_attach(device_t dev)
|
||||
if (res)
|
||||
return (ENXIO);
|
||||
|
||||
KASSERT(sc->sc_npins != 0, ("GPIO device with no pins"));
|
||||
|
||||
/*
|
||||
* Increase to get number of pins
|
||||
*/
|
||||
sc->sc_npins++;
|
||||
|
||||
KASSERT(sc->sc_npins != 0, ("GPIO device with no pins"));
|
||||
|
||||
sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF,
|
||||
M_NOWAIT | M_ZERO);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user