From 54384797560d819fc68c08ceade39ad0bba1e1b9 Mon Sep 17 00:00:00 2001 From: mk Date: Wed, 14 Jul 2010 20:21:55 +0000 Subject: [PATCH] urndis_newbuf() is only called with NULL as it's third argument so just get rid of it. ok armani --- sys/dev/usb/if_urndis.c | 44 +++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c index ec269ac3e3c..42b047acae5 100644 --- a/sys/dev/usb/if_urndis.c +++ b/sys/dev/usb/if_urndis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urndis.c,v 1.21 2010/06/06 17:53:31 miod Exp $ */ +/* $OpenBSD: if_urndis.c,v 1.22 2010/07/14 20:21:55 mk Exp $ */ /* * Copyright (c) 2010 Jonathan Armani @@ -69,7 +69,7 @@ #define DEVNAME(sc) ((sc)->sc_dev.dv_xname) -int urndis_newbuf(struct urndis_softc *, struct urndis_chain *, struct mbuf *); +int urndis_newbuf(struct urndis_softc *, struct urndis_chain *); int urndis_ioctl(struct ifnet *, u_long, caddr_t); void urndis_watchdog(struct ifnet *); @@ -869,7 +869,7 @@ urndis_decap(struct urndis_softc *sc, struct urndis_chain *c, u_int32_t len) s = splnet(); - if (urndis_newbuf(sc, c, NULL) == ENOBUFS) { + if (urndis_newbuf(sc, c) == ENOBUFS) { ifp->if_ierrors++; } else { @@ -889,32 +889,24 @@ urndis_decap(struct urndis_softc *sc, struct urndis_chain *c, u_int32_t len) } int -urndis_newbuf(struct urndis_softc *sc, struct urndis_chain *c, struct mbuf *m) +urndis_newbuf(struct urndis_softc *sc, struct urndis_chain *c) { struct mbuf *m_new = NULL; - if (m == NULL) { - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("%s: no memory for rx list " - "-- packet dropped!\n", - DEVNAME(sc)); - return (ENOBUFS); - } - MCLGET(m_new, M_DONTWAIT); - if (!(m_new->m_flags & M_EXT)) { - printf("%s: no memory for rx list " - "-- packet dropped!\n", - DEVNAME(sc)); - m_freem(m_new); - return (ENOBUFS); - } - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - } else { - m_new = m; - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - m_new->m_data = m_new->m_ext.ext_buf; + MGETHDR(m_new, M_DONTWAIT, MT_DATA); + if (m_new == NULL) { + printf("%s: no memory for rx list -- packet dropped!\n", + DEVNAME(sc)); + return (ENOBUFS); + } + MCLGET(m_new, M_DONTWAIT); + if (!(m_new->m_flags & M_EXT)) { + printf("%s: no memory for rx list -- packet dropped!\n", + DEVNAME(sc)); + m_freem(m_new); + return (ENOBUFS); } + m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; m_adj(m_new, ETHER_ALIGN); c->sc_mbuf = m_new; @@ -934,7 +926,7 @@ urndis_rx_list_init(struct urndis_softc *sc) c->sc_softc = sc; c->sc_idx = i; - if (urndis_newbuf(sc, c, NULL) == ENOBUFS) + if (urndis_newbuf(sc, c) == ENOBUFS) return (ENOBUFS); if (c->sc_xfer == NULL) { -- 2.20.1