* [PATCH] net: cpsw_new: unregister devlink on port registration failure
@ 2026-06-03 14:07 Guangshuo Li
2026-06-03 14:43 ` Loktionov, Aleksandr
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Guangshuo Li @ 2026-06-03 14:07 UTC (permalink / raw)
To: Siddharth Vadapalli, Roger Quadros, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Kevin Hao,
Alexander Sverdlin, Aleksandr Loktionov, Daniel Zahka,
Guangshuo Li, Ilias Apalodimas, Murali Karicheri,
Grygorii Strashko, linux-omap, netdev, linux-kernel
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>
---
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:
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] net: cpsw_new: unregister devlink on port registration failure
2026-06-03 14:07 [PATCH] net: cpsw_new: unregister devlink on port registration failure Guangshuo Li
@ 2026-06-03 14:43 ` Loktionov, Aleksandr
2026-06-03 16:10 ` Andrew Lunn
2026-06-03 16:58 ` Sverdlin, Alexander
2 siblings, 0 replies; 5+ messages in thread
From: Loktionov, Aleksandr @ 2026-06-03 14:43 UTC (permalink / raw)
To: Guangshuo Li, Siddharth Vadapalli, Roger Quadros, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Kevin Hao, Alexander Sverdlin, Daniel Zahka, Ilias Apalodimas,
Murali Karicheri, Grygorii Strashko, linux-omap, netdev,
linux-kernel
> -----Original Message-----
> From: Guangshuo Li <lgs201920130244@gmail.com>
> Sent: Wednesday, June 3, 2026 4:08 PM
> To: Siddharth Vadapalli <s-vadapalli@ti.com>; Roger Quadros
> <rogerq@kernel.org>; Andrew Lunn <andrew+netdev@lunn.ch>; David S.
> Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>;
> Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>;
> Kevin Hao <haokexin@gmail.com>; Alexander Sverdlin
> <alexander.sverdlin@gmail.com>; Loktionov, Aleksandr
> <aleksandr.loktionov@intel.com>; Daniel Zahka
> <daniel.zahka@gmail.com>; Guangshuo Li <lgs201920130244@gmail.com>;
> Ilias Apalodimas <ilias.apalodimas@linaro.org>; Murali Karicheri <m-
> karicheri2@ti.com>; Grygorii Strashko <grygorii.strashko@ti.com>;
> linux-omap@vger.kernel.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] net: cpsw_new: unregister devlink on port
> registration failure
>
> 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>
> ---
> 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:
> --
> 2.43.0
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: cpsw_new: unregister devlink on port registration failure
2026-06-03 14:07 [PATCH] net: cpsw_new: unregister devlink on port registration failure Guangshuo Li
2026-06-03 14:43 ` Loktionov, Aleksandr
@ 2026-06-03 16:10 ` Andrew Lunn
2026-06-03 16:58 ` Sverdlin, Alexander
2 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2026-06-03 16:10 UTC (permalink / raw)
To: Guangshuo Li
Cc: Siddharth Vadapalli, Roger Quadros, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Kevin Hao,
Alexander Sverdlin, Aleksandr Loktionov, Daniel Zahka,
Ilias Apalodimas, Murali Karicheri, Grygorii Strashko,
linux-omap, netdev, linux-kernel
On Wed, Jun 03, 2026 at 10:07:42PM +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>
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
Please set the subject line correctly.
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
Does this bother people? If not, net-next, and no Fixes tag please.
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: cpsw_new: unregister devlink on port registration failure
2026-06-03 14:07 [PATCH] net: cpsw_new: unregister devlink on port registration failure Guangshuo Li
2026-06-03 14:43 ` Loktionov, Aleksandr
2026-06-03 16:10 ` Andrew Lunn
@ 2026-06-03 16:58 ` Sverdlin, Alexander
2026-06-04 4:22 ` Guangshuo Li
2 siblings, 1 reply; 5+ messages in thread
From: Sverdlin, Alexander @ 2026-06-03 16:58 UTC (permalink / raw)
To: lgs201920130244, netdev, linux-kernel, linux-omap
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: cpsw_new: unregister devlink on port registration failure
2026-06-03 16:58 ` Sverdlin, Alexander
@ 2026-06-04 4:22 ` Guangshuo Li
0 siblings, 0 replies; 5+ messages in thread
From: Guangshuo Li @ 2026-06-04 4:22 UTC (permalink / raw)
To: Sverdlin, Alexander; +Cc: netdev, linux-kernel, linux-omap
Hi,
Thank you for your review and comments.
On Thu, 4 Jun 2026 at 00:58, Sverdlin, Alexander
<alexander.sverdlin@siemens.com> wrote:
>
> 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
I will address Andrew's feedback and send a v2 with the subject updated
accordingly. I will also target net-next and drop the Fixes tag.
Thanks,
Guangshuo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-06-04 4:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-03 14:07 [PATCH] net: cpsw_new: unregister devlink on port registration failure Guangshuo Li
2026-06-03 14:43 ` Loktionov, Aleksandr
2026-06-03 16:10 ` Andrew Lunn
2026-06-03 16:58 ` Sverdlin, Alexander
2026-06-04 4:22 ` Guangshuo Li
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®