summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2016-11-29 10:22:31 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2016-11-29 10:22:31 +0000
commit60d63461a21e4ba80eae9df4eb31ca666d333c55 (patch)
treee549fe3dcf07e8dea66ffd4bf09219dedb2508fc /sys/dev
parent2dca8b0475a26898be84df58346e417077abf80f (diff)
m_free() and m_freem() test for NULL. Simplify callers which had their own
NULL tests. ok mpi@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/ar5008.c5
-rw-r--r--sys/dev/ic/ar9003.c5
-rw-r--r--sys/dev/ic/dwc_gmac.c5
-rw-r--r--sys/dev/ic/pgt.c8
-rw-r--r--sys/dev/pci/hifn7751.c5
-rw-r--r--sys/dev/pci/if_alc.c8
-rw-r--r--sys/dev/pci/if_ixgb.c5
-rw-r--r--sys/dev/pci/if_jme.c11
-rw-r--r--sys/dev/pci/if_nfe.c5
-rw-r--r--sys/dev/pci/if_pcn.c5
-rw-r--r--sys/dev/pci/if_stge.c5
-rw-r--r--sys/dev/pci/if_xge.c5
-rw-r--r--sys/dev/usb/if_athn_usb.c5
13 files changed, 30 insertions, 47 deletions
diff --git a/sys/dev/ic/ar5008.c b/sys/dev/ic/ar5008.c
index 590de9e4b5c..5de3a212ec4 100644
--- a/sys/dev/ic/ar5008.c
+++ b/sys/dev/ic/ar5008.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5008.c,v 1.36 2016/10/08 14:35:56 stsp Exp $ */
+/* $OpenBSD: ar5008.c,v 1.37 2016/11/29 10:22:30 jsg Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -649,8 +649,7 @@ ar5008_rx_free(struct athn_softc *sc)
if (bf->bf_map != NULL)
bus_dmamap_destroy(sc->sc_dmat, bf->bf_map);
- if (bf->bf_m != NULL)
- m_freem(bf->bf_m);
+ m_freem(bf->bf_m);
}
free(rxq->bf, M_DEVBUF, 0);
diff --git a/sys/dev/ic/ar9003.c b/sys/dev/ic/ar9003.c
index 51b5d76c674..76b06d4ff54 100644
--- a/sys/dev/ic/ar9003.c
+++ b/sys/dev/ic/ar9003.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar9003.c,v 1.40 2016/10/08 14:35:56 stsp Exp $ */
+/* $OpenBSD: ar9003.c,v 1.41 2016/11/29 10:22:30 jsg Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -785,8 +785,7 @@ ar9003_rx_free(struct athn_softc *sc, int qid)
if (bf->bf_map != NULL)
bus_dmamap_destroy(sc->sc_dmat, bf->bf_map);
- if (bf->bf_m != NULL)
- m_freem(bf->bf_m);
+ m_freem(bf->bf_m);
}
free(rxq->bf, M_DEVBUF, 0);
}
diff --git a/sys/dev/ic/dwc_gmac.c b/sys/dev/ic/dwc_gmac.c
index 2f222d29cc4..5895dc7a39d 100644
--- a/sys/dev/ic/dwc_gmac.c
+++ b/sys/dev/ic/dwc_gmac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc_gmac.c,v 1.3 2016/10/08 11:20:26 kettenis Exp $ */
+/* $OpenBSD: dwc_gmac.c,v 1.4 2016/11/29 10:22:30 jsg Exp $ */
/* $NetBSD: dwc_gmac.c,v 1.34 2015/08/21 20:12:29 jmcneill Exp $ */
/*-
@@ -564,8 +564,7 @@ dwc_gmac_free_rx_ring(struct dwc_gmac_softc *sc, struct dwc_gmac_rx_ring *ring)
bus_dmamap_unload(sc->sc_dmat, data->rd_map);
bus_dmamap_destroy(sc->sc_dmat, data->rd_map);
}
- if (data->rd_m != NULL)
- m_freem(data->rd_m);
+ m_freem(data->rd_m);
}
}
diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c
index 7d4ffd380c3..edb9624520d 100644
--- a/sys/dev/ic/pgt.c
+++ b/sys/dev/ic/pgt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pgt.c,v 1.87 2016/04/13 10:49:26 mpi Exp $ */
+/* $OpenBSD: pgt.c,v 1.88 2016/11/29 10:22:30 jsg Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -1538,8 +1538,7 @@ fail:
pgt_reinit_rx_desc_frag(sc, pd);
ifp->if_ierrors++;
- if (top)
- m_freem(top);
+ m_freem(top);
return (NULL);
}
@@ -2224,8 +2223,7 @@ pgt_start(struct ifnet *ifp)
}
}
#endif
- if (m != NULL)
- m_freem(m);
+ m_freem(m);
}
}
}
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 */
diff --git a/sys/dev/usb/if_athn_usb.c b/sys/dev/usb/if_athn_usb.c
index 987095a7017..0cb8a06ee05 100644
--- a/sys/dev/usb/if_athn_usb.c
+++ b/sys/dev/usb/if_athn_usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_athn_usb.c,v 1.42 2015/12/11 16:07:02 mpi Exp $ */
+/* $OpenBSD: if_athn_usb.c,v 1.43 2016/11/29 10:22:30 jsg Exp $ */
/*-
* Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr>
@@ -2397,8 +2397,7 @@ athn_usb_stop(struct ifnet *ifp)
splx(s);
/* Flush Rx stream. */
- if (usc->rx_stream.m != NULL)
- m_freem(usc->rx_stream.m);
+ m_freem(usc->rx_stream.m);
usc->rx_stream.m = NULL;
usc->rx_stream.left = 0;
}