diff options
author | Simon Graham | 2012-02-08 01:07:38 +0100 |
---|---|---|
committer | John W. Linville | 2012-02-08 21:26:34 +0100 |
commit | 7f66c2f93e5779625c10d262c84537427a2673ca (patch) | |
tree | 460b71fcde64d7712751f3e48460f44e911bfc78 /drivers/net/wireless | |
parent | mac80211: add #ifdef CONFIG_MAC80211_VERBOSE_DEBUG for a debug printk (diff) | |
download | kernel-qcow2-linux-7f66c2f93e5779625c10d262c84537427a2673ca.tar.gz kernel-qcow2-linux-7f66c2f93e5779625c10d262c84537427a2673ca.tar.xz kernel-qcow2-linux-7f66c2f93e5779625c10d262c84537427a2673ca.zip |
rtlwifi: Handle previous allocation failures when freeing device memory
Handle previous allocation failures when freeing device memory
Signed-off-by: Simon Graham <simon.graham@virtualcomputer.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/rtlwifi/pci.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index c5f6a322feb2..c503bd3b809e 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c @@ -1148,10 +1148,12 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw, ring->idx = (ring->idx + 1) % ring->entries; } - pci_free_consistent(rtlpci->pdev, - sizeof(*ring->desc) * ring->entries, - ring->desc, ring->dma); - ring->desc = NULL; + if (ring->desc) { + pci_free_consistent(rtlpci->pdev, + sizeof(*ring->desc) * ring->entries, + ring->desc, ring->dma); + ring->desc = NULL; + } } static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci) @@ -1175,12 +1177,14 @@ static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci) kfree_skb(skb); } - pci_free_consistent(rtlpci->pdev, + if (rtlpci->rx_ring[rx_queue_idx].desc) { + pci_free_consistent(rtlpci->pdev, sizeof(*rtlpci->rx_ring[rx_queue_idx]. desc) * rtlpci->rxringcount, rtlpci->rx_ring[rx_queue_idx].desc, rtlpci->rx_ring[rx_queue_idx].dma); - rtlpci->rx_ring[rx_queue_idx].desc = NULL; + rtlpci->rx_ring[rx_queue_idx].desc = NULL; + } } } |