mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
atm: idt77252: Add missing dma_map_error()
[ Upstream commit c489096335
]
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/20250624064148.12815-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
8d672a1a6b
commit
8ea9a9fb79
|
@ -852,6 +852,8 @@ queue_skb(struct idt77252_dev *card, struct vc_map *vc,
|
||||||
|
|
||||||
IDT77252_PRV_PADDR(skb) = dma_map_single(&card->pcidev->dev, skb->data,
|
IDT77252_PRV_PADDR(skb) = dma_map_single(&card->pcidev->dev, skb->data,
|
||||||
skb->len, DMA_TO_DEVICE);
|
skb->len, DMA_TO_DEVICE);
|
||||||
|
if (dma_mapping_error(&card->pcidev->dev, IDT77252_PRV_PADDR(skb)))
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
error = -EINVAL;
|
error = -EINVAL;
|
||||||
|
|
||||||
|
@ -1857,6 +1859,8 @@ add_rx_skb(struct idt77252_dev *card, int queue,
|
||||||
paddr = dma_map_single(&card->pcidev->dev, skb->data,
|
paddr = dma_map_single(&card->pcidev->dev, skb->data,
|
||||||
skb_end_pointer(skb) - skb->data,
|
skb_end_pointer(skb) - skb->data,
|
||||||
DMA_FROM_DEVICE);
|
DMA_FROM_DEVICE);
|
||||||
|
if (dma_mapping_error(&card->pcidev->dev, paddr))
|
||||||
|
goto outpoolrm;
|
||||||
IDT77252_PRV_PADDR(skb) = paddr;
|
IDT77252_PRV_PADDR(skb) = paddr;
|
||||||
|
|
||||||
if (push_rx_skb(card, skb, queue)) {
|
if (push_rx_skb(card, skb, queue)) {
|
||||||
|
@ -1871,6 +1875,7 @@ outunmap:
|
||||||
dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb),
|
dma_unmap_single(&card->pcidev->dev, IDT77252_PRV_PADDR(skb),
|
||||||
skb_end_pointer(skb) - skb->data, DMA_FROM_DEVICE);
|
skb_end_pointer(skb) - skb->data, DMA_FROM_DEVICE);
|
||||||
|
|
||||||
|
outpoolrm:
|
||||||
handle = IDT77252_PRV_POOL(skb);
|
handle = IDT77252_PRV_POOL(skb);
|
||||||
card->sbpool[POOL_QUEUE(handle)].skb[POOL_INDEX(handle)] = NULL;
|
card->sbpool[POOL_QUEUE(handle)].skb[POOL_INDEX(handle)] = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user