Author: loos
Date: Tue Nov 12 13:55:19 2013
New Revision: 258047
URL: http://svnweb.freebsd.org/changeset/base/258047

Log:
  Move the KASSERT() check to the point before the increase of number of pins.
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/dev/gpio/gpiobus.c

Modified: head/sys/dev/gpio/gpiobus.c
==============================================================================
--- head/sys/dev/gpio/gpiobus.c Tue Nov 12 13:44:50 2013        (r258046)
+++ head/sys/dev/gpio/gpiobus.c Tue Nov 12 13:55:19 2013        (r258047)
@@ -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);
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to