Linux USB
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@cixtech.com>
To: gregkh@linuxfoundation.org, pawell@cadence.com, rogerq@kernel.org
Cc: linux-usb@vger.kernel.org, cix-kernel-upstream@cixtech.com,
	Peter Chen <peter.chen@cixtech.com>,
	sashiko-bot <sashiko-bot@kernel.org>
Subject: [PATCH 1/1] usb: cdns3: plat: fix leaked role switch on core role initialization failure
Date: Thu, 14 May 2026 09:01:14 +0800	[thread overview]
Message-ID: <20260514010114.2436781-2-peter.chen@cixtech.com> (raw)
In-Reply-To: <20260514010114.2436781-1-peter.chen@cixtech.com>

Calling usb_role_switch_unregister if core role initialization failure.

Fixes: e4d7362dc9cd ("usb: cdns3: Add USBSSP platform driver support")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/linux-devicetree/agKaEePSFknhDBg2@nchen-desktop/T/#m21e1d9c1574eb127ce03c0c2a1a49002ce435b52
Signed-off-by: Peter Chen <peter.chen@cixtech.com>
---
 drivers/usb/cdns3/cdns3-plat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/cdns3/cdns3-plat.c b/drivers/usb/cdns3/cdns3-plat.c
index 3fe3109a3688..91159910fe95 100644
--- a/drivers/usb/cdns3/cdns3-plat.c
+++ b/drivers/usb/cdns3/cdns3-plat.c
@@ -167,7 +167,7 @@ static int cdns3_plat_probe(struct platform_device *pdev)
 	cdns->host_init = cdns3_plat_host_init;
 	ret = cdns_core_init_role(cdns);
 	if (ret)
-		goto err_cdns_init;
+		goto err_cdns_init_role;
 
 	device_set_wakeup_capable(dev, true);
 	pm_runtime_set_active(dev);
@@ -186,6 +186,9 @@ static int cdns3_plat_probe(struct platform_device *pdev)
 
 	return 0;
 
+err_cdns_init_role:
+	if (cdns->role_sw)
+		usb_role_switch_unregister(cdns->role_sw);
 err_cdns_init:
 	set_phy_power_off(cdns);
 err_phy_power_on:
-- 
2.50.1


      reply	other threads:[~2026-05-14  1:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14  1:01 [PATCH 0/1] usb: cdns3 fixes on usb-next Peter Chen
2026-05-14  1:01 ` Peter Chen [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=20260514010114.2436781-2-peter.chen@cixtech.com \
    --to=peter.chen@cixtech.com \
    --cc=cix-kernel-upstream@cixtech.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pawell@cadence.com \
    --cc=rogerq@kernel.org \
    --cc=sashiko-bot@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