diff options
author | Adrian Chadd <adrian@FreeBSD.org> | 2016-06-16 17:59:15 +0000 |
---|---|---|
committer | Adrian Chadd <adrian@FreeBSD.org> | 2016-06-16 17:59:15 +0000 |
commit | 5b4dc397af5fd31ae9a49c1bb0a8b030e6c054ca (patch) | |
tree | 8d6556ed44d2b064f5e9a9b2c4074189c88e2a23 /sys/dev/iwm/if_iwm.c | |
parent | a3d81a8a8a4f8379b0870238ae417f7986d7d299 (diff) | |
download | src-5b4dc397af5fd31ae9a49c1bb0a8b030e6c054ca.tar.gz src-5b4dc397af5fd31ae9a49c1bb0a8b030e6c054ca.zip |
[iwm] free RX ring / NVM memory after they're used.
* Free RX ring during detach
* Free NVM memory after parsing
Tested:
* 7260, STA mode
Submitted by: Imre Vadasz <imre@vdsz.com>
Approved by: re (gjb)
Obtained from: dragonflybsd
Differential Revision: https://reviews.freebsd.org/D6817
Notes
Notes:
svn path=/head/; revision=301970
Diffstat (limited to 'sys/dev/iwm/if_iwm.c')
-rw-r--r-- | sys/dev/iwm/if_iwm.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 58215553c8a6..4b0f4b86793e 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -1823,7 +1823,7 @@ iwm_parse_nvm_data(struct iwm_softc *sc, struct iwm_nvm_section { uint16_t length; - const uint8_t *data; + uint8_t *data; }; static int @@ -1860,6 +1860,8 @@ iwm_nvm_init(struct iwm_softc *sc) "%s: Read NVM\n", __func__); + memset(nvm_sections, 0, sizeof(nvm_sections)); + /* TODO: find correct NVM max size for a section */ nvm_buffer = malloc(IWM_OTP_LOW_IMAGE_SIZE, M_DEVBUF, M_NOWAIT); if (nvm_buffer == NULL) @@ -1883,10 +1885,15 @@ iwm_nvm_init(struct iwm_softc *sc) nvm_sections[section].length = len; } free(nvm_buffer, M_DEVBUF); - 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); + } + + return error; } /* @@ -5008,6 +5015,7 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211) ieee80211_ifdetach(&sc->sc_ic); /* Free descriptor rings */ + iwm_free_rx_ring(sc, &sc->rxq); for (i = 0; i < nitems(sc->txq); i++) iwm_free_tx_ring(sc, &sc->txq[i]); |