Hi,
After parsing the nvm_sections data in iwm_nvm_init(), we can free the
nvm_sections[i].data allocations again.
In the iwm_attach() failure path, the iwm_free_rx_ring() call for freeing
the rx ring memory was missing.
Index: if_iwm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
retrieving revision 1.86
diff -u -r1.86 if_iwm.c
--- if_iwm.c 3 Jun 2016 16:16:25 -0000 1.86
+++ if_iwm.c 10 Jun 2016 11:47:29 -0000
@@ -3085,10 +3085,16 @@
nvm_sections[section].length = len;
}
free(buf, M_DEVBUF, bufsz);
- if (error)
- return error;
+ if (error == 0)
+ error = iwm_parse_nvm_sections(sc, nvm_sections);
- return iwm_parse_nvm_sections(sc, nvm_sections);
+ for (i = 0; i < IWM_NVM_NUM_OF_SECTIONS; i++) {
+ if (nvm_sections[i].data != NULL)
+ free(nvm_sections[i].data, M_DEVBUF,
+ nvm_sections[i].length);
+ }
+
+ return error;
}
/*
@@ -8055,6 +8061,7 @@
/* Free allocated memory if something failed during attachment. */
fail4: while (--txq_i >= 0)
iwm_free_tx_ring(sc, &sc->txq[txq_i]);
+ iwm_free_rx_ring(sc, &sc->rxq);
iwm_free_sched(sc);
fail3: if (sc->ict_dma.vaddr != NULL)
iwm_free_ict(sc);