mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethernet: mtk_eth_soc: add missing check for rhashtable_init
@ 2024-05-16  9:24 Chen Ni
  2024-05-16  9:56 ` ] " Hariprasad Kelam
  2024-05-16 10:10 ` AngeloGioacchino Del Regno
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Ni @ 2024-05-16  9:24 UTC (permalink / raw)
  To: nbd, sean.wang, Mark-MC.Lee, lorenzo, davem, edumazet, kuba,
	pabeni, matthias.bgg, angelogioacchino.delregno
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek, Chen Ni

Add check for the return value of rhashtable_init() and return the error
if it fails in order to catch the error.

Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/net/ethernet/mediatek/mtk_ppe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
index 0acee405a749..f7e5e6e52cdf 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@ -884,12 +884,15 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int index)
 	struct mtk_ppe *ppe;
 	u32 foe_flow_size;
 	void *foe;
+	int ret;
 
 	ppe = devm_kzalloc(dev, sizeof(*ppe), GFP_KERNEL);
 	if (!ppe)
 		return NULL;
 
-	rhashtable_init(&ppe->l2_flows, &mtk_flow_l2_ht_params);
+	ret = rhashtable_init(&ppe->l2_flows, &mtk_flow_l2_ht_params);
+	if (ret)
+		return NULL;
 
 	/* need to allocate a separate device, since it PPE DMA access is
 	 * not coherent.
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-16 10:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-16  9:24 [PATCH net-next] net: ethernet: mtk_eth_soc: add missing check for rhashtable_init Chen Ni
2024-05-16  9:56 ` ] " Hariprasad Kelam
2024-05-16 10:10 ` AngeloGioacchino Del Regno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®