From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Zhang Changzhong <zhangchangzhong@huawei.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Grygorii Strashko <grygorii.strashko@ti.com>,
"Jesse Brandeburg" <jesse.brandeburg@intel.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] net: ethernet: ti: am65-cpsw: fix error handling in am65_cpsw_nuss_probe()
Date: Fri, 25 Nov 2022 15:36:00 +0100 [thread overview]
Message-ID: <Y4DS0PYdpVeLFrWv@boxer> (raw)
In-Reply-To: <1669258989-18277-1-git-send-email-zhangchangzhong@huawei.com>
On Thu, Nov 24, 2022 at 11:03:08AM +0800, Zhang Changzhong wrote:
> The am65_cpsw_nuss_cleanup_ndev() function calls unregister_netdev()
> even if register_netdev() fails, which triggers WARN_ON(1) in
If this has been only compile tested then I assume you haven't encounter
this WARN_ON(1) trigger by yourself?
> unregister_netdevice_many(). To fix it, make sure that
> unregister_netdev() is called only on registered netdev.
>
> Compile tested only.
>
> Fixes: 84b4aa493249 ("net: ethernet: ti: am65-cpsw: add multi port support in mac-only mode")
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
> ---
> drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> index c50b137..d04a239 100644
> --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> @@ -2082,7 +2082,7 @@ static void am65_cpsw_nuss_cleanup_ndev(struct am65_cpsw_common *common)
>
> for (i = 0; i < common->port_num; i++) {
> port = &common->ports[i];
> - if (port->ndev)
> + if (port->ndev && port->ndev->reg_state == NETREG_REGISTERED)
> unregister_netdev(port->ndev);
It seems that if am65_cpsw_nuss_register_ndevs() fails on
register_netdev() port->ndev is still a valid pointer, so your assumption
looks correct to me.
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> }
> }
> --
> 2.9.5
>
next prev parent reply other threads:[~2022-11-25 14:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-24 3:03 [PATCH net] net: ethernet: ti: am65-cpsw: fix error handling in am65_cpsw_nuss_probe() Zhang Changzhong
2022-11-25 14:36 ` Maciej Fijalkowski [this message]
2022-11-28 11:10 ` patchwork-bot+netdevbpf
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=Y4DS0PYdpVeLFrWv@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=grygorii.strashko@ti.com \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zhangchangzhong@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.