Date: Tue, 12 Nov 2013 13:55:19 +0000 (UTC) From: Luiz Otavio O Souza <loos@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258047 - head/sys/dev/gpio Message-ID: <201311121355.rACDtJZl058155@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311121355.rACDtJZl058155>