Skip to content

Commit

Permalink
staging: rtl8192e: Fix failure to check pci_map_single()
Browse files Browse the repository at this point in the history
Beginning with kernel 3.8, the DMA mapping routines issue a warning
for the first call to pci_map_single() that is not checked with a
pci_dma_mapping_error() call.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Larry Finger authored and Greg Kroah-Hartman committed Jan 7, 2013
1 parent 0d826c3 commit 2dcb4a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,8 @@ void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc,
pTxFwInfo->TxRate,
cb_desc);

if (pci_dma_mapping_error(priv->pdev, mapping))
RT_TRACE(COMP_ERR, "DMA Mapping error\n");;
if (cb_desc->bAMPDUEnable) {
pTxFwInfo->AllowAggregation = 1;
pTxFwInfo->RxMF = cb_desc->ampdu_factor;
Expand Down Expand Up @@ -1280,6 +1282,8 @@ void rtl8192_tx_fill_cmd_desc(struct net_device *dev,
dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len,
PCI_DMA_TODEVICE);

if (pci_dma_mapping_error(priv->pdev, mapping))
RT_TRACE(COMP_ERR, "DMA Mapping error\n");;
memset(entry, 0, 12);
entry->LINIP = cb_desc->bLastIniPkt;
entry->FirstSeg = 1;
Expand Down
11 changes: 9 additions & 2 deletions drivers/staging/rtl8192e/rtl8192e/rtl_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2104,7 +2104,10 @@ static short rtl8192_alloc_rx_desc_ring(struct net_device *dev)
skb_tail_pointer_rsl(skb),
priv->rxbuffersize,
PCI_DMA_FROMDEVICE);

if (pci_dma_mapping_error(priv->pdev, *mapping)) {
dev_kfree_skb_any(skb);
return -1;
}
entry->BufferAddress = cpu_to_le32(*mapping);

entry->Length = priv->rxbuffersize;
Expand Down Expand Up @@ -2397,7 +2400,11 @@ static void rtl8192_rx_normal(struct net_device *dev)
skb_tail_pointer_rsl(skb),
priv->rxbuffersize,
PCI_DMA_FROMDEVICE);

if (pci_dma_mapping_error(priv->pdev,
*((dma_addr_t *)skb->cb))) {
dev_kfree_skb_any(skb);
return;
}
}
done:
pdesc->BufferAddress = cpu_to_le32(*((dma_addr_t *)skb->cb));
Expand Down

0 comments on commit 2dcb4a2

Please sign in to comment.