From: Arbab Haider <arbabhaider649@gmail.com>
To: stable@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Guangshuo Li <lgs201920130244@gmail.com>,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
Alexander Sverdlin <alexander.sverdlin@siemens.com>,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH 7.0.y 4/5] net: cpsw_new: unregister devlink on port registration failure
Date: Wed, 5 Aug 2026 15:01:35 +0500 [thread overview]
Message-ID: <20260805100136.59101-4-arbabhaider649@gmail.com> (raw)
In-Reply-To: <20260805100136.59101-1-arbabhaider649@gmail.com>
From: Guangshuo Li <lgs201920130244@gmail.com>
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.
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Link: https://patch.msgid.link/20260604043115.1409134-1-lgs201920130244@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Upstream commit b64f763b607426ac97e44b114f0b8844ac3b86dd ]
---
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 c5be359f3c66..b6e25a4658d1 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.53.0
next prev parent reply other threads:[~2026-08-05 10:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 10:01 [PATCH 7.0.y 1/5] net: mvneta: re-enable percpu interrupt on resume Arbab Haider
2026-08-05 10:01 ` [PATCH 7.0.y 2/5] net: mvneta: support EPROBE_DEFER when reading MAC address Arbab Haider
2026-08-05 10:01 ` [PATCH 7.0.y 3/5] net: macb: drop in-flight Tx SKBs on close Arbab Haider
2026-08-05 10:01 ` Arbab Haider [this message]
2026-08-05 10:01 ` [PATCH 7.0.y 5/5] net: stmmac: fix transmit interrupt coalescing Arbab Haider
2026-08-05 16:41 ` [PATCH 7.0.y 1/5] net: mvneta: re-enable percpu interrupt on resume Sasha Levin
2026-08-05 18:37 ` Arbab Haider
2026-08-05 18:38 ` Arbab Haider
2026-08-06 4:44 ` Greg KH
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=20260805100136.59101-4-arbabhaider649@gmail.com \
--to=arbabhaider649@gmail.com \
--cc=aleksandr.loktionov@intel.com \
--cc=alexander.sverdlin@siemens.com \
--cc=kuba@kernel.org \
--cc=lgs201920130244@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@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