Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 562c5a70 authored by John Crispin's avatar John Crispin Committed by David S. Miller
Browse files

net: mediatek: add missing return code check



The code fails to check if the scratch memory was properly allocated. Add
this check and return with an error if the allocation failed.

Signed-off-by: default avatarJohn Crispin <john@phrozen.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0b392be9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -495,6 +495,9 @@ static int mtk_init_fq_dma(struct mtk_eth *eth)

	eth->scratch_head = kcalloc(cnt, MTK_QDMA_PAGE_SIZE,
				    GFP_KERNEL);
	if (unlikely(!eth->scratch_head))
		return -ENOMEM;

	dma_addr = dma_map_single(eth->dev,
				  eth->scratch_head, cnt * MTK_QDMA_PAGE_SIZE,
				  DMA_FROM_DEVICE);