714163c86bb048db1d53c520c423c497779fb915
[openwrt/staging/ldir.git] /
1 From: Dan Carpenter <dan.carpenter@oracle.com>
2 Date: Thu, 21 Apr 2022 18:49:02 +0300
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: add check for allocation failure
4
5 Check if the kzalloc() failed.
6
7 Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
8 Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
9 Signed-off-by: David S. Miller <davem@davemloft.net>
10 ---
11
12 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
13 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
14 @@ -827,6 +827,8 @@ void mtk_wed_add_hw(struct device_node *
15 goto unlock;
16
17 hw = kzalloc(sizeof(*hw), GFP_KERNEL);
18 + if (!hw)
19 + goto unlock;
20 hw->node = np;
21 hw->regs = regs;
22 hw->eth = eth;