@@ -1015,9 +1015,10 @@ static bool dma64_txidle(struct dma_info *di)
10151015
10161016/*
10171017 * post receive buffers
1018- * return false is refill failed completely and ring is empty this will stall
1019- * the rx dma and user might want to call rxfill again asap. This unlikely
1020- * happens on memory-rich NIC, but often on memory-constrained dongle
1018+ * Return false if refill failed completely or dma mapping failed. The ring
1019+ * is empty, which will stall the rx dma and user might want to call rxfill
1020+ * again asap. This is unlikely to happen on a memory-rich NIC, but often on
1021+ * memory-constrained dongle.
10211022 */
10221023bool dma_rxfill (struct dma_pub * pub )
10231024{
@@ -1078,6 +1079,8 @@ bool dma_rxfill(struct dma_pub *pub)
10781079
10791080 pa = dma_map_single (di -> dmadev , p -> data , di -> rxbufsize ,
10801081 DMA_FROM_DEVICE );
1082+ if (dma_mapping_error (di -> dmadev , pa ))
1083+ return false;
10811084
10821085 /* save the free packet pointer */
10831086 di -> rxp [rxout ] = p ;
@@ -1284,7 +1287,11 @@ static void dma_txenq(struct dma_info *di, struct sk_buff *p)
12841287
12851288 /* get physical address of buffer start */
12861289 pa = dma_map_single (di -> dmadev , data , len , DMA_TO_DEVICE );
1287-
1290+ /* if mapping failed, free skb */
1291+ if (dma_mapping_error (di -> dmadev , pa )) {
1292+ brcmu_pkt_buf_free_skb (p );
1293+ return ;
1294+ }
12881295 /* With a DMA segment list, Descriptor table is filled
12891296 * using the segment list instead of looping over
12901297 * buffers in multi-chain DMA. Therefore, EOF for SGLIST
0 commit comments