Linux-ARM-Kernel Archive mirror
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Chen Ni <nichen@iscas.ac.cn>,
	nbd@nbd.name, sean.wang@mediatek.com, Mark-MC.Lee@mediatek.com,
	lorenzo@kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, matthias.bgg@gmail.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH net-next] net: ethernet: mtk_eth_soc: add missing check for rhashtable_init
Date: Thu, 16 May 2024 12:10:35 +0200	[thread overview]
Message-ID: <f9e09d27-4e28-4ed9-95a5-66c8dba6d499@collabora.com> (raw)
In-Reply-To: <20240516092427.3897322-1-nichen@iscas.ac.cn>

Il 16/05/24 11:24, Chen Ni ha scritto:
> 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;

return PTR_ERR(ret);

..then in mtk_eth_soc.c, you will have to fix the check:
			if (!eth->ppe[i]) {

to IS_ERR_OR_NULL( ... )

Cheers,
Angelo

>   
>   	/* need to allocate a separate device, since it PPE DMA access is
>   	 * not coherent.



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      parent reply	other threads:[~2024-05-16 10:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f9e09d27-4e28-4ed9-95a5-66c8dba6d499@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=nichen@iscas.ac.cn \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).