diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-10-01 15:34:49 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-10-01 15:34:49 +0000 |
commit | a730dedabc875f93e81898068b1cccdb9e45cb7c (patch) | |
tree | 059cc27503e1389b0da52a36e3fd0e692e1f24e2 /sys/dev/pci/if_em.c | |
parent | d75aaeaf6b0231dbe849cd06ddac7f63b1e30bcc (diff) |
More easy bzero() -> M_ZERO. Use 'p = malloc(sizeof(*p) ...' where
obvious.
Diffstat (limited to 'sys/dev/pci/if_em.c')
-rw-r--r-- | sys/dev/pci/if_em.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 21889c0f8eb..48d8e9e1171 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.172 2007/05/31 01:04:57 henning Exp $ */ +/* $OpenBSD: if_em.c,v 1.173 2007/10/01 15:34:48 krw Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include <dev/pci/if_em.h> @@ -1841,18 +1841,13 @@ em_dma_free(struct em_softc *sc, struct em_dma_alloc *dma) int em_allocate_transmit_structures(struct em_softc *sc) { - if (!(sc->tx_buffer_area = - (struct em_buffer *) malloc(sizeof(struct em_buffer) * - sc->num_tx_desc, M_DEVBUF, - M_NOWAIT))) { + if (!(sc->tx_buffer_area = malloc(sizeof(struct em_buffer) * + sc->num_tx_desc, M_DEVBUF, M_NOWAIT | M_ZERO))) { printf("%s: Unable to allocate tx_buffer memory\n", sc->sc_dv.dv_xname); return (ENOMEM); } - bzero(sc->tx_buffer_area, - sizeof(struct em_buffer) * sc->num_tx_desc); - return (0); } @@ -2279,18 +2274,13 @@ em_allocate_receive_structures(struct em_softc *sc) int i, error; struct em_buffer *rx_buffer; - if (!(sc->rx_buffer_area = - (struct em_buffer *) malloc(sizeof(struct em_buffer) * - sc->num_rx_desc, M_DEVBUF, - M_NOWAIT))) { + if (!(sc->rx_buffer_area = malloc(sizeof(struct em_buffer) * + sc->num_rx_desc, M_DEVBUF, M_NOWAIT | M_ZERO))) { printf("%s: Unable to allocate rx_buffer memory\n", sc->sc_dv.dv_xname); return (ENOMEM); } - bzero(sc->rx_buffer_area, - sizeof(struct em_buffer) * sc->num_rx_desc); - sc->rxtag = sc->osdep.em_pa.pa_dmat; error = bus_dmamap_create(sc->rxtag, MCLBYTES, 1, MCLBYTES, |