svn commit: r238832 - head/sys/dev/ath
Adrian Chadd
adrian at FreeBSD.org
Fri Jul 27 10:38:18 UTC 2012
Author: adrian
Date: Fri Jul 27 10:38:17 2012
New Revision: 238832
URL: http://svn.freebsd.org/changeset/base/238832
Log:
Modify ath_descdma_cleanup() to handle ath_descdma instances with no
buffers.
ath_descdma is now being used for things other than the classical
combination of ath_buf + ath_desc allocations. In this particular case,
don't try to free and blank out the ath_buf list if it's not passed in.
Modified:
head/sys/dev/ath/if_ath.c
Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c Fri Jul 27 10:31:26 2012 (r238831)
+++ head/sys/dev/ath/if_ath.c Fri Jul 27 10:38:17 2012 (r238832)
@@ -3021,27 +3021,32 @@ ath_descdma_cleanup(struct ath_softc *sc
bus_dma_tag_destroy(dd->dd_dmat);
}
- TAILQ_FOREACH(bf, head, bf_list) {
- if (bf->bf_m) {
- m_freem(bf->bf_m);
- bf->bf_m = NULL;
- }
- if (bf->bf_dmamap != NULL) {
- bus_dmamap_destroy(sc->sc_dmat, bf->bf_dmamap);
- bf->bf_dmamap = NULL;
- }
- ni = bf->bf_node;
- bf->bf_node = NULL;
- if (ni != NULL) {
- /*
- * Reclaim node reference.
- */
- ieee80211_free_node(ni);
+ if (head != NULL) {
+ TAILQ_FOREACH(bf, head, bf_list) {
+ if (bf->bf_m) {
+ m_freem(bf->bf_m);
+ bf->bf_m = NULL;
+ }
+ if (bf->bf_dmamap != NULL) {
+ bus_dmamap_destroy(sc->sc_dmat, bf->bf_dmamap);
+ bf->bf_dmamap = NULL;
+ }
+ ni = bf->bf_node;
+ bf->bf_node = NULL;
+ if (ni != NULL) {
+ /*
+ * Reclaim node reference.
+ */
+ ieee80211_free_node(ni);
+ }
}
}
- TAILQ_INIT(head);
- free(dd->dd_bufptr, M_ATHDEV);
+ if (head != NULL)
+ TAILQ_INIT(head);
+
+ if (dd->dd_bufptr != NULL)
+ free(dd->dd_bufptr, M_ATHDEV);
memset(dd, 0, sizeof(*dd));
}
More information about the svn-src-all
mailing list