mediatek: update the ethernet compat string
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.4 / 0082-net-next-mediatek-add-missing-return-code-check.patch
1 From 51ca1e9f141499fd7c95bff5401215b706656754 Mon Sep 17 00:00:00 2001
2 From: John Crispin <john@phrozen.org>
3 Date: Sat, 23 Apr 2016 09:06:05 +0200
4 Subject: [PATCH 082/102] net-next: mediatek: add missing return code check
5
6 The code fails to check if the scratch memory was properly allocated. Add
7 this check and return with an error if the allocation failed.
8
9 Signed-off-by: Sean Wang <keyhaede@gmail.com>
10 Signed-off-by: John Crispin <john@phrozen.org>
11 ---
12 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 +++
13 1 file changed, 3 insertions(+)
14
15 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
16 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
17 @@ -498,6 +498,9 @@ static int mtk_init_fq_dma(struct mtk_et
18
19 eth->scratch_head = kcalloc(cnt, MTK_QDMA_PAGE_SIZE,
20 GFP_KERNEL);
21 + if (unlikely(!eth->scratch_head))
22 + return -ENOMEM;
23 +
24 dma_addr = dma_map_single(eth->dev,
25 eth->scratch_head, cnt * MTK_QDMA_PAGE_SIZE,
26 DMA_FROM_DEVICE);