diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2008-12-03 06:35:29 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-12-05 09:35:59 -0500 |
commit | f8316df10c4e3bec5b4c3a5a8e026c577640c3a6 (patch) | |
tree | f56af9c85de35bda97a0b45275eed6b6f7362712 /drivers/net/wireless/ath9k/beacon.c | |
parent | 73a5267087b5acd4a4288e0a1b809f09ca578d49 (diff) |
ath9k: Check for pci_map_single() errors
pci_map_single() can fail so detect those errors with
pci_dma_mapping_error() and deal with them accordingly.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/beacon.c')
-rw-r--r-- | drivers/net/wireless/ath9k/beacon.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath9k/beacon.c b/drivers/net/wireless/ath9k/beacon.c index fe6929dc2937..507299bf0136 100644 --- a/drivers/net/wireless/ath9k/beacon.c +++ b/drivers/net/wireless/ath9k/beacon.c | |||
@@ -190,6 +190,13 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) | |||
190 | pci_map_single(sc->pdev, skb->data, | 190 | pci_map_single(sc->pdev, skb->data, |
191 | skb->len, | 191 | skb->len, |
192 | PCI_DMA_TODEVICE); | 192 | PCI_DMA_TODEVICE); |
193 | if (unlikely(pci_dma_mapping_error(sc->pdev, bf->bf_buf_addr))) { | ||
194 | dev_kfree_skb_any(skb); | ||
195 | bf->bf_mpdu = NULL; | ||
196 | DPRINTF(sc, ATH_DBG_CONFIG, | ||
197 | "pci_dma_mapping_error() on beaconing\n"); | ||
198 | return NULL; | ||
199 | } | ||
193 | 200 | ||
194 | skb = ieee80211_get_buffered_bc(sc->hw, vif); | 201 | skb = ieee80211_get_buffered_bc(sc->hw, vif); |
195 | 202 | ||
@@ -392,11 +399,18 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id) | |||
392 | memcpy(&hdr[1], &val, sizeof(val)); | 399 | memcpy(&hdr[1], &val, sizeof(val)); |
393 | } | 400 | } |
394 | 401 | ||
402 | bf->bf_mpdu = skb; | ||
395 | bf->bf_buf_addr = bf->bf_dmacontext = | 403 | bf->bf_buf_addr = bf->bf_dmacontext = |
396 | pci_map_single(sc->pdev, skb->data, | 404 | pci_map_single(sc->pdev, skb->data, |
397 | skb->len, | 405 | skb->len, |
398 | PCI_DMA_TODEVICE); | 406 | PCI_DMA_TODEVICE); |
399 | bf->bf_mpdu = skb; | 407 | if (unlikely(pci_dma_mapping_error(sc->pdev, bf->bf_buf_addr))) { |
408 | dev_kfree_skb_any(skb); | ||
409 | bf->bf_mpdu = NULL; | ||
410 | DPRINTF(sc, ATH_DBG_CONFIG, | ||
411 | "pci_dma_mapping_error() on beacon alloc\n"); | ||
412 | return -ENOMEM; | ||
413 | } | ||
400 | 414 | ||
401 | return 0; | 415 | return 0; |
402 | } | 416 | } |