summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath9k/recv.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2008-12-03 14:35:29 +0300
committerJohn W. Linville <linville@tuxdriver.com>2008-12-05 17:35:59 +0300
commitf8316df10c4e3bec5b4c3a5a8e026c577640c3a6 (patch)
treef56af9c85de35bda97a0b45275eed6b6f7362712 /drivers/net/wireless/ath9k/recv.c
parent73a5267087b5acd4a4288e0a1b809f09ca578d49 (diff)
downloadlinux-f8316df10c4e3bec5b4c3a5a8e026c577640c3a6.tar.xz
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.c17
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)
bf->bf_buf_addr = pci_map_single(sc->pdev, skb->data,
sc->sc_rxbufsize,
PCI_DMA_FROMDEVICE);
+ if (unlikely(pci_dma_mapping_error(sc->pdev,
+ bf->bf_buf_addr))) {
+ dev_kfree_skb_any(skb);
+ bf->bf_mpdu = NULL;
+ DPRINTF(sc, ATH_DBG_CONFIG,
+ "pci_dma_mapping_error() on RX init\n");
+ error = -ENOMEM;
+ break;
+ }
bf->bf_dmacontext = bf->bf_buf_addr;
}
sc->sc_rxlink = NULL;
@@ -589,6 +598,14 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
bf->bf_buf_addr = pci_map_single(sc->pdev, requeue_skb->data,
sc->sc_rxbufsize,
PCI_DMA_FROMDEVICE);
+ if (unlikely(pci_dma_mapping_error(sc->pdev,
+ bf->bf_buf_addr))) {
+ dev_kfree_skb_any(requeue_skb);
+ bf->bf_mpdu = NULL;
+ DPRINTF(sc, ATH_DBG_CONFIG,
+ "pci_dma_mapping_error() on RX\n");
+ break;
+ }
bf->bf_dmacontext = bf->bf_buf_addr;
/*