From: "Sverdlin, Alexander" <alexander.sverdlin@siemens.com>
To: "lgs201920130244@gmail.com" <lgs201920130244@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH] net: cpsw_new: unregister devlink on port registration failure
Date: Wed, 3 Jun 2026 16:58:42 +0000 [thread overview]
Message-ID: <c835f4f16639eb47111aa64c2968193fb71957ad.camel@siemens.com> (raw)
In-Reply-To: <20260603140742.1398659-1-lgs201920130244@gmail.com>
Hi Guangshuo,
On Wed, 2026-06-03 at 22:07 +0800, Guangshuo Li wrote:
> cpsw_probe() registers devlink before registering the CPSW ports.
>
> If cpsw_register_ports() fails, the error path only unregisters the
> notifiers and then releases the lower level resources. It does not undo
> the successful cpsw_register_devlink() call, leaving the devlink instance
> and its parameters registered after probe has failed.
>
> Add a devlink cleanup label for the path where devlink registration has
> already succeeded, and use it when port registration fails.
>
> Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
thanks for the patch! Apart from the issue Andrew mentioned, the fix itself
looks good to me,
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> ---
> drivers/net/ethernet/ti/cpsw_new.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c
> index 7f42f58a4b03..95b3b58db6e0 100644
> --- a/drivers/net/ethernet/ti/cpsw_new.c
> +++ b/drivers/net/ethernet/ti/cpsw_new.c
> @@ -2050,7 +2050,7 @@ static int cpsw_probe(struct platform_device *pdev)
>
> ret = cpsw_register_ports(cpsw);
> if (ret)
> - goto clean_unregister_notifiers;
> + goto clean_unregister_devlink;
>
> dev_notice(dev, "initialized (regs %pa, pool size %d) hw_ver:%08X %d.%d (%d)\n",
> &ss_res->start, descs_pool_size,
> @@ -2062,6 +2062,8 @@ static int cpsw_probe(struct platform_device *pdev)
>
> return 0;
>
> +clean_unregister_devlink:
> + cpsw_unregister_devlink(cpsw);
> clean_unregister_notifiers:
> cpsw_unregister_notifiers(cpsw);
> clean_cpts:
--
Alexander Sverdlin
Siemens AG
www.siemens.com
next prev parent reply other threads:[~2026-06-03 16:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 14:07 Guangshuo Li
2026-06-03 14:43 ` Loktionov, Aleksandr
2026-06-03 16:10 ` Andrew Lunn
2026-06-03 16:58 ` Sverdlin, Alexander [this message]
2026-06-04 4:22 ` Guangshuo Li
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=c835f4f16639eb47111aa64c2968193fb71957ad.camel@siemens.com \
--to=alexander.sverdlin@siemens.com \
--cc=lgs201920130244@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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
all inboxes | Powered by JetHome®