[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <YmF87nnzwiJC71k6@kili>
Date: Thu, 21 Apr 2022 18:49:02 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Felix Fietkau <nbd@....name>
Cc: John Crispin <john@...ozen.org>,
Sean Wang <sean.wang@...iatek.com>,
Mark Lee <Mark-MC.Lee@...iatek.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Matthias Brugger <matthias.bgg@...il.com>,
netdev@...r.kernel.org, linux-mediatek@...ts.infradead.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH net-next] 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@...cle.com>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
index f0eacf819cd9..a2793bbb8ce0 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;
--
2.20.1
Powered by blists - more mailing lists