@@ -1015,9 +1015,10 @@ static bool dma64_txidle(struct dma_info *di)
1015
1015
1016
1016
/*
1017
1017
* 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.
1021
1022
*/
1022
1023
bool dma_rxfill (struct dma_pub * pub )
1023
1024
{
@@ -1078,6 +1079,8 @@ bool dma_rxfill(struct dma_pub *pub)
1078
1079
1079
1080
pa = dma_map_single (di -> dmadev , p -> data , di -> rxbufsize ,
1080
1081
DMA_FROM_DEVICE );
1082
+ if (dma_mapping_error (di -> dmadev , pa ))
1083
+ return false;
1081
1084
1082
1085
/* save the free packet pointer */
1083
1086
di -> rxp [rxout ] = p ;
@@ -1284,7 +1287,11 @@ static void dma_txenq(struct dma_info *di, struct sk_buff *p)
1284
1287
1285
1288
/* get physical address of buffer start */
1286
1289
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
+ }
1288
1295
/* With a DMA segment list, Descriptor table is filled
1289
1296
* using the segment list instead of looping over
1290
1297
* buffers in multi-chain DMA. Therefore, EOF for SGLIST
0 commit comments