diff options
author | Joe Perches <joe@perches.com> | 2014-08-08 17:24:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-08 18:57:29 -0400 |
commit | 8ac41b9dc719b4a5c65a2192988e8199278bb71a (patch) | |
tree | e77dcccc65305e857b66ac8d57f8f7c27969e875 /drivers/net/wireless/rtlwifi/pci.c | |
parent | 504e3b4f5a210057419fe7a2ea3a0b5b3bc15aa1 (diff) |
rtlwifi: use pci_zalloc_consistent
Remove the now unnecessary memset too.
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Chaoming Li <chaoming_li@realsil.com.cn>
Cc: "John W. Linville" <linville@tuxdriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/net/wireless/rtlwifi/pci.c')
-rw-r--r-- | drivers/net/wireless/rtlwifi/pci.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index dae55257f0e8..67d1ee6edcad 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -1092,16 +1092,14 @@ static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw, | |||
1092 | u32 nextdescaddress; | 1092 | u32 nextdescaddress; |
1093 | int i; | 1093 | int i; |
1094 | 1094 | ||
1095 | ring = pci_alloc_consistent(rtlpci->pdev, | 1095 | ring = pci_zalloc_consistent(rtlpci->pdev, sizeof(*ring) * entries, |
1096 | sizeof(*ring) * entries, &dma); | 1096 | &dma); |
1097 | |||
1098 | if (!ring || (unsigned long)ring & 0xFF) { | 1097 | if (!ring || (unsigned long)ring & 0xFF) { |
1099 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 1098 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
1100 | "Cannot allocate TX ring (prio = %d)\n", prio); | 1099 | "Cannot allocate TX ring (prio = %d)\n", prio); |
1101 | return -ENOMEM; | 1100 | return -ENOMEM; |
1102 | } | 1101 | } |
1103 | 1102 | ||
1104 | memset(ring, 0, sizeof(*ring) * entries); | ||
1105 | rtlpci->tx_ring[prio].desc = ring; | 1103 | rtlpci->tx_ring[prio].desc = ring; |
1106 | rtlpci->tx_ring[prio].dma = dma; | 1104 | rtlpci->tx_ring[prio].dma = dma; |
1107 | rtlpci->tx_ring[prio].idx = 0; | 1105 | rtlpci->tx_ring[prio].idx = 0; |
@@ -1139,10 +1137,9 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw) | |||
1139 | for (rx_queue_idx = 0; rx_queue_idx < RTL_PCI_MAX_RX_QUEUE; | 1137 | for (rx_queue_idx = 0; rx_queue_idx < RTL_PCI_MAX_RX_QUEUE; |
1140 | rx_queue_idx++) { | 1138 | rx_queue_idx++) { |
1141 | rtlpci->rx_ring[rx_queue_idx].desc = | 1139 | rtlpci->rx_ring[rx_queue_idx].desc = |
1142 | pci_alloc_consistent(rtlpci->pdev, | 1140 | pci_zalloc_consistent(rtlpci->pdev, |
1143 | sizeof(*rtlpci->rx_ring[rx_queue_idx]. | 1141 | sizeof(*rtlpci->rx_ring[rx_queue_idx].desc) * rtlpci->rxringcount, |
1144 | desc) * rtlpci->rxringcount, | 1142 | &rtlpci->rx_ring[rx_queue_idx].dma); |
1145 | &rtlpci->rx_ring[rx_queue_idx].dma); | ||
1146 | 1143 | ||
1147 | if (!rtlpci->rx_ring[rx_queue_idx].desc || | 1144 | if (!rtlpci->rx_ring[rx_queue_idx].desc || |
1148 | (unsigned long)rtlpci->rx_ring[rx_queue_idx].desc & 0xFF) { | 1145 | (unsigned long)rtlpci->rx_ring[rx_queue_idx].desc & 0xFF) { |
@@ -1151,10 +1148,6 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw) | |||
1151 | return -ENOMEM; | 1148 | return -ENOMEM; |
1152 | } | 1149 | } |
1153 | 1150 | ||
1154 | memset(rtlpci->rx_ring[rx_queue_idx].desc, 0, | ||
1155 | sizeof(*rtlpci->rx_ring[rx_queue_idx].desc) * | ||
1156 | rtlpci->rxringcount); | ||
1157 | |||
1158 | rtlpci->rx_ring[rx_queue_idx].idx = 0; | 1151 | rtlpci->rx_ring[rx_queue_idx].idx = 0; |
1159 | 1152 | ||
1160 | /* If amsdu_8k is disabled, set buffersize to 4096. This | 1153 | /* If amsdu_8k is disabled, set buffersize to 4096. This |