Commit 7f66c2f9 authored by Simon Graham's avatar Simon Graham Committed by John W. Linville

rtlwifi: Handle previous allocation failures when freeing device memory

Handle previous allocation failures when freeing device memory
Signed-off-by: default avatarSimon Graham <simon.graham@virtualcomputer.com>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 79027596
...@@ -1148,10 +1148,12 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw, ...@@ -1148,10 +1148,12 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw,
ring->idx = (ring->idx + 1) % ring->entries; ring->idx = (ring->idx + 1) % ring->entries;
} }
if (ring->desc) {
pci_free_consistent(rtlpci->pdev, pci_free_consistent(rtlpci->pdev,
sizeof(*ring->desc) * ring->entries, sizeof(*ring->desc) * ring->entries,
ring->desc, ring->dma); ring->desc, ring->dma);
ring->desc = NULL; ring->desc = NULL;
}
} }
static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci) static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci)
...@@ -1175,6 +1177,7 @@ static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci) ...@@ -1175,6 +1177,7 @@ static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci)
kfree_skb(skb); kfree_skb(skb);
} }
if (rtlpci->rx_ring[rx_queue_idx].desc) {
pci_free_consistent(rtlpci->pdev, pci_free_consistent(rtlpci->pdev,
sizeof(*rtlpci->rx_ring[rx_queue_idx]. sizeof(*rtlpci->rx_ring[rx_queue_idx].
desc) * rtlpci->rxringcount, desc) * rtlpci->rxringcount,
...@@ -1182,6 +1185,7 @@ static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci) ...@@ -1182,6 +1185,7 @@ static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci)
rtlpci->rx_ring[rx_queue_idx].dma); rtlpci->rx_ring[rx_queue_idx].dma);
rtlpci->rx_ring[rx_queue_idx].desc = NULL; rtlpci->rx_ring[rx_queue_idx].desc = NULL;
} }
}
} }
static int _rtl_pci_init_trx_ring(struct ieee80211_hw *hw) static int _rtl_pci_init_trx_ring(struct ieee80211_hw *hw)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment