diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-04-21 18:49:02 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-04-25 13:26:30 +0300 |
commit | a00e41bf2f47343b8d0a265cc7710f89e9233dcd (patch) | |
tree | 9621e7e2474ffc1901806e02cf115ed1122124ca /drivers/net/ethernet/mediatek/mtk_wed.c | |
parent | 60d78e9fce8886b403a21fecb0dd13f9c0f12e1f (diff) | |
download | linux-a00e41bf2f47343b8d0a265cc7710f89e9233dcd.tar.xz |
net: ethernet: mtk_eth_soc: add check for allocation failure
Check if the kzalloc() failed.
Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mediatek/mtk_wed.c')
-rw-r--r-- | drivers/net/ethernet/mediatek/mtk_wed.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c index 5530f7991d1d..8f0cd3196aac 100644 --- a/drivers/net/ethernet/mediatek/mtk_wed.c +++ b/drivers/net/ethernet/mediatek/mtk_wed.c @@ -827,6 +827,8 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth, goto unlock; hw = kzalloc(sizeof(*hw), GFP_KERNEL); + if (!hw) + goto unlock; hw->node = np; hw->regs = regs; hw->eth = eth; |