summaryrefslogtreecommitdiffstats
path: root/sys/dev/gpio
diff options
context:
space:
mode:
authorloos <loos@FreeBSD.org>2013-11-12 13:55:19 +0000
committerloos <loos@FreeBSD.org>2013-11-12 13:55:19 +0000
commitce4163e4f3478c8819e2e474356811fc1c641aba (patch)
treec8f4864cc6831a53f0ac7f6d0a2e999028fc5e70 /sys/dev/gpio
parentc1e7b8113d7992650b3f256567ecce0b67fc3bdd (diff)
downloadFreeBSD-src-ce4163e4f3478c8819e2e474356811fc1c641aba.zip
FreeBSD-src-ce4163e4f3478c8819e2e474356811fc1c641aba.tar.gz
Move the KASSERT() check to the point before the increase of number of pins.
Approved by: adrian (mentor)
Diffstat (limited to 'sys/dev/gpio')
-rw-r--r--sys/dev/gpio/gpiobus.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c
index 6abb10c..1b1f420 100644
--- a/sys/dev/gpio/gpiobus.c
+++ b/sys/dev/gpio/gpiobus.c
@@ -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);
OpenPOWER on IntegriCloud