mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
net: ag71xx: Add missing check after DMA map
[ Upstream commit 96a1e15e60216b52da0e6da5336b6d7f5b0188b0 ] The DMA map functions can fail and should be tested for errors. Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20250716095733.37452-3-fourier.thomas@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
128ed836b7
commit
54e755bd47
1 changed files with 9 additions and 0 deletions
|
|
@ -1049,6 +1049,11 @@ static bool ag71xx_fill_rx_buf(struct ag71xx *ag, struct ag71xx_buf *buf,
|
|||
buf->rx.rx_buf = data;
|
||||
buf->rx.dma_addr = dma_map_single(&ag->pdev->dev, data, ag->rx_buf_size,
|
||||
DMA_FROM_DEVICE);
|
||||
if (dma_mapping_error(&ag->pdev->dev, buf->rx.dma_addr)) {
|
||||
skb_free_frag(data);
|
||||
buf->rx.rx_buf = NULL;
|
||||
return false;
|
||||
}
|
||||
desc->data = (u32)buf->rx.dma_addr + offset;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1343,6 +1348,10 @@ static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff *skb,
|
|||
|
||||
dma_addr = dma_map_single(&ag->pdev->dev, skb->data, skb->len,
|
||||
DMA_TO_DEVICE);
|
||||
if (dma_mapping_error(&ag->pdev->dev, dma_addr)) {
|
||||
netif_dbg(ag, tx_err, ndev, "DMA mapping error\n");
|
||||
goto err_drop;
|
||||
}
|
||||
|
||||
i = ring->curr & ring_mask;
|
||||
desc = ag71xx_ring_desc(ring, i);
|
||||
|
|
|
|||
Loading…
Reference in a new issue