]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.14/0037-rtlwifi-Handle-previous-allocation-failures-when-fre.patch
linux-ti335x-psp 3.2: update to 3.2.14
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.14 / 0037-rtlwifi-Handle-previous-allocation-failures-when-fre.patch
1 From 80ee9108bee3d22e90191a67036133de09faf7cc Mon Sep 17 00:00:00 2001
2 From: Simon Graham <simon.graham@virtualcomputer.com>
3 Date: Tue, 7 Feb 2012 18:07:38 -0600
4 Subject: [PATCH 037/147] rtlwifi: Handle previous allocation failures when
5  freeing device memory
7 commit 7f66c2f93e5779625c10d262c84537427a2673ca upstream.
9 Handle previous allocation failures when freeing device memory
11 Signed-off-by: Simon Graham <simon.graham@virtualcomputer.com>
12 Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
13 Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
15 ---
16  drivers/net/wireless/rtlwifi/pci.c |   16 ++++++++++------
17  1 file changed, 10 insertions(+), 6 deletions(-)
19 diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
20 index 19bb550..9afcad3 100644
21 --- a/drivers/net/wireless/rtlwifi/pci.c
22 +++ b/drivers/net/wireless/rtlwifi/pci.c
23 @@ -1155,10 +1155,12 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw,
24                 ring->idx = (ring->idx + 1) % ring->entries;
25         }
26  
27 -       pci_free_consistent(rtlpci->pdev,
28 -                           sizeof(*ring->desc) * ring->entries,
29 -                           ring->desc, ring->dma);
30 -       ring->desc = NULL;
31 +       if (ring->desc) {
32 +               pci_free_consistent(rtlpci->pdev,
33 +                                   sizeof(*ring->desc) * ring->entries,
34 +                                   ring->desc, ring->dma);
35 +               ring->desc = NULL;
36 +       }
37  }
38  
39  static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci)
40 @@ -1182,12 +1184,14 @@ static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci)
41                         kfree_skb(skb);
42                 }
43  
44 -               pci_free_consistent(rtlpci->pdev,
45 +               if (rtlpci->rx_ring[rx_queue_idx].desc) {
46 +                       pci_free_consistent(rtlpci->pdev,
47                                     sizeof(*rtlpci->rx_ring[rx_queue_idx].
48                                            desc) * rtlpci->rxringcount,
49                                     rtlpci->rx_ring[rx_queue_idx].desc,
50                                     rtlpci->rx_ring[rx_queue_idx].dma);
51 -               rtlpci->rx_ring[rx_queue_idx].desc = NULL;
52 +                       rtlpci->rx_ring[rx_queue_idx].desc = NULL;
53 +               }
54         }
55  }
56  
57 -- 
58 1.7.9.4