[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PH0PR18MB44744D577E2114AA1B72857DDEED2@PH0PR18MB4474.namprd18.prod.outlook.com>
Date: Thu, 16 May 2024 09:56:25 +0000
From: Hariprasad Kelam <hkelam@...vell.com>
To: Chen Ni <nichen@...as.ac.cn>, "nbd@....name" <nbd@....name>,
"sean.wang@...iatek.com" <sean.wang@...iatek.com>,
"Mark-MC.Lee@...iatek.com"
<Mark-MC.Lee@...iatek.com>,
"lorenzo@...nel.org" <lorenzo@...nel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com"
<edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"matthias.bgg@...il.com"
<matthias.bgg@...il.com>,
"angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>
Subject: ] [PATCH net-next] net: ethernet: mtk_eth_soc: add missing check for
rhashtable_init
> 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@...as.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;
Instead of returning NULL, return actual error ERR_PTR(ret) and use IS_ERR_OR_NULL API to validate the error
Thanks,
Hariprasad k
>
> /* need to allocate a separate device, since it PPE DMA access is
> * not coherent.
> --
> 2.25.1
>
Powered by blists - more mailing lists