summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@openbsd.org>2010-05-16 08:55:39 +0000
committerdamien <damien@openbsd.org>2010-05-16 08:55:39 +0000
commit85aea44dcea912f2a44bbd7c58d1e8d8ac0b64f0 (patch)
tree8d322fed9f8e4a57f3a83b037f66433e80c398ce
parentfix athn_updateslot for fast PLL clock and 40MHz CBW (diff)
downloadwireguard-openbsd-85aea44dcea912f2a44bbd7c58d1e8d8ac0b64f0.tar.xz
wireguard-openbsd-85aea44dcea912f2a44bbd7c58d1e8d8ac0b64f0.zip
return early in {ar5008,ar9003}_rx_free if buffers have not been
allocated.
-rw-r--r--sys/dev/ic/ar5008.c8
-rw-r--r--sys/dev/ic/ar9003.c7
2 files changed, 9 insertions, 6 deletions
diff --git a/sys/dev/ic/ar5008.c b/sys/dev/ic/ar5008.c
index 1d88ba7af5e..51efacdf524 100644
--- a/sys/dev/ic/ar5008.c
+++ b/sys/dev/ic/ar5008.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5008.c,v 1.3 2010/05/12 16:28:40 damien Exp $ */
+/* $OpenBSD: ar5008.c,v 1.4 2010/05/16 08:55:39 damien Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -614,6 +614,8 @@ ar5008_rx_free(struct athn_softc *sc)
struct athn_rx_buf *bf;
int i;
+ if (rxq->bf == NULL)
+ return;
for (i = 0; i < ATHN_NRXBUFS; i++) {
bf = &rxq->bf[i];
@@ -622,8 +624,8 @@ ar5008_rx_free(struct athn_softc *sc)
if (bf->bf_m != NULL)
m_freem(bf->bf_m);
}
- if (rxq->bf != NULL)
- free(rxq->bf, M_DEVBUF);
+ free(rxq->bf, M_DEVBUF);
+
/* Free Rx descriptors. */
if (rxq->descs != NULL) {
if (rxq->descs != NULL) {
diff --git a/sys/dev/ic/ar9003.c b/sys/dev/ic/ar9003.c
index 636c0a52ce7..64c037ea510 100644
--- a/sys/dev/ic/ar9003.c
+++ b/sys/dev/ic/ar9003.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar9003.c,v 1.5 2010/05/12 16:28:40 damien Exp $ */
+/* $OpenBSD: ar9003.c,v 1.6 2010/05/16 08:55:39 damien Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -665,6 +665,8 @@ ar9003_rx_free(struct athn_softc *sc, int qid)
struct athn_rx_buf *bf;
int i;
+ if (rxq->bf == NULL)
+ return;
for (i = 0; i < rxq->count; i++) {
bf = &rxq->bf[i];
@@ -673,8 +675,7 @@ ar9003_rx_free(struct athn_softc *sc, int qid)
if (bf->bf_m != NULL)
m_freem(bf->bf_m);
}
- if (rxq->bf != NULL)
- free(rxq->bf, M_DEVBUF);
+ free(rxq->bf, M_DEVBUF);
}
void