diff options
| author | Pyun YongHyeon <yongari@FreeBSD.org> | 2007-07-13 04:55:52 +0000 |
|---|---|---|
| committer | Pyun YongHyeon <yongari@FreeBSD.org> | 2007-07-13 04:55:52 +0000 |
| commit | 02eaf70f0dc235b7e4ddebc342e9d1ff16d2944c (patch) | |
| tree | bdd34f07456ea5266edade8787a573e08f02c522 | |
| parent | 2042fd30633e1b129703106daafbd1060cf8966d (diff) | |
Notes
| -rw-r--r-- | sys/dev/txp/if_txp.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/dev/txp/if_txp.c b/sys/dev/txp/if_txp.c index 78f85c02f827..cc493eceefe0 100644 --- a/sys/dev/txp/if_txp.c +++ b/sys/dev/txp/if_txp.c @@ -40,10 +40,6 @@ __FBSDID("$FreeBSD$"); /* * Driver for 3c990 (Typhoon) Ethernet ASIC */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #include <sys/param.h> #include <sys/systm.h> #include <sys/sockio.h> @@ -265,6 +261,11 @@ txp_attach(dev) sc->sc_fwbuf = contigmalloc(32768, M_DEVBUF, M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0); + if (sc->sc_fwbuf == NULL) { + device_printf(dev, "no memory for firmware\n"); + error = ENXIO; + goto fail; + } error = txp_download_fw(sc); contigfree(sc->sc_fwbuf, 32768, M_DEVBUF); sc->sc_fwbuf = NULL; @@ -274,6 +275,11 @@ txp_attach(dev) sc->sc_ldata = contigmalloc(sizeof(struct txp_ldata), M_DEVBUF, M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0); + if (sc->sc_ldata == NULL) { + device_printf(dev, "no memory for descriptor ring\n"); + error = ENXIO; + goto fail; + } bzero(sc->sc_ldata, sizeof(struct txp_ldata)); if (txp_alloc_rings(sc)) { |
