diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-11-29 10:22:31 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-11-29 10:22:31 +0000 |
commit | 60d63461a21e4ba80eae9df4eb31ca666d333c55 (patch) | |
tree | e549fe3dcf07e8dea66ffd4bf09219dedb2508fc /sys/dev/pci | |
parent | 2dca8b0475a26898be84df58346e417077abf80f (diff) |
m_free() and m_freem() test for NULL. Simplify callers which had their own
NULL tests.
ok mpi@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/hifn7751.c | 5 | ||||
-rw-r--r-- | sys/dev/pci/if_alc.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/if_ixgb.c | 5 | ||||
-rw-r--r-- | sys/dev/pci/if_jme.c | 11 | ||||
-rw-r--r-- | sys/dev/pci/if_nfe.c | 5 | ||||
-rw-r--r-- | sys/dev/pci/if_pcn.c | 5 | ||||
-rw-r--r-- | sys/dev/pci/if_stge.c | 5 | ||||
-rw-r--r-- | sys/dev/pci/if_xge.c | 5 |
8 files changed, 19 insertions, 30 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index e3331572720..5436723128f 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.174 2015/12/10 21:00:51 naddy Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.175 2016/11/29 10:22:30 jsg Exp $ */ /* * Invertex AEON / Hifn 7751 driver @@ -2676,8 +2676,7 @@ out: bus_dmamap_unload(sc->sc_dmat, cmd->src_map); bus_dmamap_destroy(sc->sc_dmat, cmd->src_map); } - if (cmd->dstu.dst_m != NULL) - m_freem(cmd->dstu.dst_m); + m_freem(cmd->dstu.dst_m); explicit_bzero(cmd, sizeof(*cmd)); free(cmd, M_DEVBUF, sizeof *cmd); crp->crp_etype = err; diff --git a/sys/dev/pci/if_alc.c b/sys/dev/pci/if_alc.c index 5040f247c8e..67a47b9c018 100644 --- a/sys/dev/pci/if_alc.c +++ b/sys/dev/pci/if_alc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_alc.c,v 1.39 2016/04/13 10:34:32 mpi Exp $ */ +/* $OpenBSD: if_alc.c,v 1.40 2016/11/29 10:22:30 jsg Exp $ */ /*- * Copyright (c) 2009, Pyun YongHyeon <yongari@FreeBSD.org> * All rights reserved. @@ -1912,8 +1912,7 @@ alc_rxeof(struct alc_softc *sc, struct rx_rdesc *rrd) if (alc_newbuf(sc, rxd) != 0) { ifp->if_iqdrops++; /* Reuse Rx buffers. */ - if (sc->alc_cdata.alc_rxhead != NULL) - m_freem(sc->alc_cdata.alc_rxhead); + m_freem(sc->alc_cdata.alc_rxhead); break; } @@ -2377,8 +2376,7 @@ alc_stop(struct alc_softc *sc) CSR_WRITE_4(sc, ALC_INTR_STATUS, 0xFFFFFFFF); /* Reclaim Rx buffers that have been processed. */ - if (sc->alc_cdata.alc_rxhead != NULL) - m_freem(sc->alc_cdata.alc_rxhead); + m_freem(sc->alc_cdata.alc_rxhead); ALC_RXCHAIN_RESET(sc); /* * Free Tx/Rx mbufs still in the queues. diff --git a/sys/dev/pci/if_ixgb.c b/sys/dev/pci/if_ixgb.c index 02f96cc819f..2ee11993d47 100644 --- a/sys/dev/pci/if_ixgb.c +++ b/sys/dev/pci/if_ixgb.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_ixgb.c,v 1.69 2016/04/13 10:34:32 mpi Exp $ */ +/* $OpenBSD: if_ixgb.c,v 1.70 2016/11/29 10:22:30 jsg Exp $ */ #include <dev/pci/if_ixgb.h> @@ -1786,8 +1786,7 @@ ixgb_rxeof(struct ixgb_softc *sc, int count) sc->rx_buffer_area[i].m_head = NULL; } else { sc->dropped_pkts++; - if (sc->fmp != NULL) - m_freem(sc->fmp); + m_freem(sc->fmp); sc->fmp = NULL; sc->lmp = NULL; } diff --git a/sys/dev/pci/if_jme.c b/sys/dev/pci/if_jme.c index 0173ee09de5..682cd490b03 100644 --- a/sys/dev/pci/if_jme.c +++ b/sys/dev/pci/if_jme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_jme.c,v 1.47 2016/04/13 10:34:32 mpi Exp $ */ +/* $OpenBSD: if_jme.c,v 1.48 2016/11/29 10:22:30 jsg Exp $ */ /*- * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org> * All rights reserved. @@ -258,8 +258,7 @@ jme_miibus_statchg(struct device *dev) jme_stop_tx(sc); jme_rxeof(sc); - if (sc->jme_cdata.jme_rxhead != NULL) - m_freem(sc->jme_cdata.jme_rxhead); + m_freem(sc->jme_cdata.jme_rxhead); JME_RXCHAIN_RESET(sc); jme_txeof(sc); @@ -2042,8 +2041,7 @@ jme_stop(struct jme_softc *sc) #ifdef foo /* Reclaim Rx/Tx buffers that have been completed. */ jme_rxeof(sc); - if (sc->jme_cdata.jme_rxhead != NULL) - m_freem(sc->jme_cdata.jme_rxhead); + m_freem(sc->jme_cdata.jme_rxhead); JME_RXCHAIN_RESET(sc); jme_txeof(sc); #endif @@ -2051,8 +2049,7 @@ jme_stop(struct jme_softc *sc) /* * Free partial finished RX segments */ - if (sc->jme_cdata.jme_rxhead != NULL) - m_freem(sc->jme_cdata.jme_rxhead); + m_freem(sc->jme_cdata.jme_rxhead); JME_RXCHAIN_RESET(sc); /* diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c index b19a8e516f8..daa894e4957 100644 --- a/sys/dev/pci/if_nfe.c +++ b/sys/dev/pci/if_nfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nfe.c,v 1.117 2016/04/13 10:34:32 mpi Exp $ */ +/* $OpenBSD: if_nfe.c,v 1.118 2016/11/29 10:22:30 jsg Exp $ */ /*- * Copyright (c) 2006, 2007 Damien Bergamini <damien.bergamini@free.fr> @@ -1318,8 +1318,7 @@ nfe_free_rx_ring(struct nfe_softc *sc, struct nfe_rx_ring *ring) bus_dmamap_unload(sc->sc_dmat, data->map); bus_dmamap_destroy(sc->sc_dmat, data->map); } - if (data->m != NULL) - m_freem(data->m); + m_freem(data->m); } } diff --git a/sys/dev/pci/if_pcn.c b/sys/dev/pci/if_pcn.c index 336af291763..b2adb5645bd 100644 --- a/sys/dev/pci/if_pcn.c +++ b/sys/dev/pci/if_pcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pcn.c,v 1.41 2016/04/13 10:34:32 mpi Exp $ */ +/* $OpenBSD: if_pcn.c,v 1.42 2016/11/29 10:22:30 jsg Exp $ */ /* $NetBSD: if_pcn.c,v 1.26 2005/05/07 09:15:44 is Exp $ */ /* @@ -896,8 +896,7 @@ pcn_start(struct ifnet *ifp) */ ifq_set_oactive(&ifp->if_snd); bus_dmamap_unload(sc->sc_dmat, dmamap); - if (m != NULL) - m_freem(m); + m_freem(m); ifq_deq_rollback(&ifp->if_snd, m0); break; } diff --git a/sys/dev/pci/if_stge.c b/sys/dev/pci/if_stge.c index 4b486bcbffe..51ea9e5ef7f 100644 --- a/sys/dev/pci/if_stge.c +++ b/sys/dev/pci/if_stge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_stge.c,v 1.67 2016/04/13 10:34:32 mpi Exp $ */ +/* $OpenBSD: if_stge.c,v 1.68 2016/11/29 10:22:30 jsg Exp $ */ /* $NetBSD: if_stge.c,v 1.27 2005/05/16 21:35:32 bouyer Exp $ */ /*- @@ -889,8 +889,7 @@ stge_rxintr(struct stge_softc *sc) STGE_INIT_RXDESC(sc, i); if ((status & RFD_FrameEnd) == 0) sc->sc_rxdiscard = 1; - if (sc->sc_rxhead != NULL) - m_freem(sc->sc_rxhead); + m_freem(sc->sc_rxhead); STGE_RXCHAIN_RESET(sc); continue; } diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c index 1aa6ddb071a..ddcaca5496b 100644 --- a/sys/dev/pci/if_xge.c +++ b/sys/dev/pci/if_xge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xge.c,v 1.73 2016/05/16 04:34:25 dlg Exp $ */ +/* $OpenBSD: if_xge.c,v 1.74 2016/11/29 10:22:30 jsg Exp $ */ /* $NetBSD: if_xge.c,v 1.1 2005/09/09 10:30:27 ragge Exp $ */ /* @@ -1360,8 +1360,7 @@ xge_add_rxbuf(struct xge_softc *sc, int id) ((m[3]->m_flags & M_EXT) == 0) || ((m[4]->m_flags & M_EXT) == 0)) { /* Out of something */ for (i = 0; i < 5; i++) - if (m[i] != NULL) - m_free(m[i]); + m_free(m[i]); return (ENOBUFS); } /* Link'em together */ |