.. | .. |
---|
183 | 183 | .can_ext_scan = true, |
---|
184 | 184 | }; |
---|
185 | 185 | |
---|
186 | | -static const struct of_device_id mwifiex_pcie_of_match_table[] = { |
---|
| 186 | +static const struct of_device_id mwifiex_pcie_of_match_table[] __maybe_unused = { |
---|
187 | 187 | { .compatible = "pci11ab,2b42" }, |
---|
188 | 188 | { .compatible = "pci1b4b,2b42" }, |
---|
189 | 189 | { } |
---|
.. | .. |
---|
200 | 200 | } |
---|
201 | 201 | |
---|
202 | 202 | static void mwifiex_pcie_work(struct work_struct *work); |
---|
| 203 | +static int mwifiex_pcie_delete_rxbd_ring(struct mwifiex_adapter *adapter); |
---|
| 204 | +static int mwifiex_pcie_delete_evtbd_ring(struct mwifiex_adapter *adapter); |
---|
203 | 205 | |
---|
204 | 206 | static int |
---|
205 | 207 | mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb, |
---|
.. | .. |
---|
794 | 796 | if (!skb) { |
---|
795 | 797 | mwifiex_dbg(adapter, ERROR, |
---|
796 | 798 | "Unable to allocate skb for RX ring.\n"); |
---|
797 | | - kfree(card->rxbd_ring_vbase); |
---|
798 | 799 | return -ENOMEM; |
---|
799 | 800 | } |
---|
800 | 801 | |
---|
801 | 802 | if (mwifiex_map_pci_memory(adapter, skb, |
---|
802 | 803 | MWIFIEX_RX_DATA_BUF_SIZE, |
---|
803 | | - DMA_FROM_DEVICE)) |
---|
804 | | - return -1; |
---|
| 804 | + DMA_FROM_DEVICE)) { |
---|
| 805 | + kfree_skb(skb); |
---|
| 806 | + return -ENOMEM; |
---|
| 807 | + } |
---|
805 | 808 | |
---|
806 | 809 | buf_pa = MWIFIEX_SKB_DMA_ADDR(skb); |
---|
807 | 810 | |
---|
.. | .. |
---|
851 | 854 | if (!skb) { |
---|
852 | 855 | mwifiex_dbg(adapter, ERROR, |
---|
853 | 856 | "Unable to allocate skb for EVENT buf.\n"); |
---|
854 | | - kfree(card->evtbd_ring_vbase); |
---|
855 | 857 | return -ENOMEM; |
---|
856 | 858 | } |
---|
857 | 859 | skb_put(skb, MAX_EVENT_SIZE); |
---|
.. | .. |
---|
859 | 861 | if (mwifiex_map_pci_memory(adapter, skb, MAX_EVENT_SIZE, |
---|
860 | 862 | DMA_FROM_DEVICE)) { |
---|
861 | 863 | kfree_skb(skb); |
---|
862 | | - kfree(card->evtbd_ring_vbase); |
---|
863 | | - return -1; |
---|
| 864 | + return -ENOMEM; |
---|
864 | 865 | } |
---|
865 | 866 | |
---|
866 | 867 | buf_pa = MWIFIEX_SKB_DMA_ADDR(skb); |
---|
.. | .. |
---|
1060 | 1061 | */ |
---|
1061 | 1062 | static int mwifiex_pcie_create_rxbd_ring(struct mwifiex_adapter *adapter) |
---|
1062 | 1063 | { |
---|
| 1064 | + int ret; |
---|
1063 | 1065 | struct pcie_service_card *card = adapter->card; |
---|
1064 | 1066 | const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; |
---|
1065 | 1067 | |
---|
.. | .. |
---|
1098 | 1100 | (u32)((u64)card->rxbd_ring_pbase >> 32), |
---|
1099 | 1101 | card->rxbd_ring_size); |
---|
1100 | 1102 | |
---|
1101 | | - return mwifiex_init_rxq_ring(adapter); |
---|
| 1103 | + ret = mwifiex_init_rxq_ring(adapter); |
---|
| 1104 | + if (ret) |
---|
| 1105 | + mwifiex_pcie_delete_rxbd_ring(adapter); |
---|
| 1106 | + return ret; |
---|
1102 | 1107 | } |
---|
1103 | 1108 | |
---|
1104 | 1109 | /* |
---|
.. | .. |
---|
1129 | 1134 | */ |
---|
1130 | 1135 | static int mwifiex_pcie_create_evtbd_ring(struct mwifiex_adapter *adapter) |
---|
1131 | 1136 | { |
---|
| 1137 | + int ret; |
---|
1132 | 1138 | struct pcie_service_card *card = adapter->card; |
---|
1133 | 1139 | const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; |
---|
1134 | 1140 | |
---|
.. | .. |
---|
1163 | 1169 | (u32)((u64)card->evtbd_ring_pbase >> 32), |
---|
1164 | 1170 | card->evtbd_ring_size); |
---|
1165 | 1171 | |
---|
1166 | | - return mwifiex_pcie_init_evt_ring(adapter); |
---|
| 1172 | + ret = mwifiex_pcie_init_evt_ring(adapter); |
---|
| 1173 | + if (ret) |
---|
| 1174 | + mwifiex_pcie_delete_evtbd_ring(adapter); |
---|
| 1175 | + return ret; |
---|
1167 | 1176 | } |
---|
1168 | 1177 | |
---|
1169 | 1178 | /* |
---|