Move the KASSERT() check to the point before the increase of number of pins.

Approved by:	adrian (mentor)
This commit is contained in:
Luiz Otavio O Souza 2013-11-12 13:55:19 +00:00
parent 8ad579cac3
commit a1f621566e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=258047

View file

@ -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);