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/recv.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/recv.c')
-rw-r--r-- | drivers/net/wireless/ath9k/recv.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c index 51e058710d17..7a455468823b 100644 --- a/drivers/net/wireless/ath9k/recv.c +++ b/drivers/net/wireless/ath9k/recv.c | |||
@@ -304,6 +304,15 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) | |||
304 | bf->bf_buf_addr = pci_map_single(sc->pdev, skb->data, | 304 | bf->bf_buf_addr = pci_map_single(sc->pdev, skb->data, |
305 | sc->sc_rxbufsize, | 305 | sc->sc_rxbufsize, |
306 | PCI_DMA_FROMDEVICE); | 306 | PCI_DMA_FROMDEVICE); |
307 | if (unlikely(pci_dma_mapping_error(sc->pdev, | ||
308 | bf->bf_buf_addr))) { | ||
309 | dev_kfree_skb_any(skb); | ||
310 | bf->bf_mpdu = NULL; | ||
311 | DPRINTF(sc, ATH_DBG_CONFIG, | ||
312 | "pci_dma_mapping_error() on RX init\n"); | ||
313 | error = -ENOMEM; | ||
314 | break; | ||
315 | } | ||
307 | bf->bf_dmacontext = bf->bf_buf_addr; | 316 | bf->bf_dmacontext = bf->bf_buf_addr; |
308 | } | 317 | } |
309 | sc->sc_rxlink = NULL; | 318 | sc->sc_rxlink = NULL; |
@@ -589,6 +598,14 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
589 | bf->bf_buf_addr = pci_map_single(sc->pdev, requeue_skb->data, | 598 | bf->bf_buf_addr = pci_map_single(sc->pdev, requeue_skb->data, |
590 | sc->sc_rxbufsize, | 599 | sc->sc_rxbufsize, |
591 | PCI_DMA_FROMDEVICE); | 600 | PCI_DMA_FROMDEVICE); |
601 | if (unlikely(pci_dma_mapping_error(sc->pdev, | ||
602 | bf->bf_buf_addr))) { | ||
603 | dev_kfree_skb_any(requeue_skb); | ||
604 | bf->bf_mpdu = NULL; | ||
605 | DPRINTF(sc, ATH_DBG_CONFIG, | ||
606 | "pci_dma_mapping_error() on RX\n"); | ||
607 | break; | ||
608 | } | ||
592 | bf->bf_dmacontext = bf->bf_buf_addr; | 609 | bf->bf_dmacontext = bf->bf_buf_addr; |
593 | 610 | ||
594 | /* | 611 | /* |