summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2016-06-10 11:27:58 (GMT)
committerDavid S. Miller <davem@davemloft.net>2016-06-11 06:29:28 (GMT)
commit562c5a70400c75f50d99de631666ac7cc2f03958 (patch)
tree35ece322f036c00f23f7038088e4e51651f5f87b /drivers/net
parent0b392be9a86560dae3af2e7528f226ff465ab549 (diff)
downloadlinux-562c5a70400c75f50d99de631666ac7cc2f03958.tar.xz
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: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/mediatek/mtk_eth_soc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 4763252..11cd730 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -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);