Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: usb3503: Propagate resume errors and unwind the clock
@ 2026-11-12  7:17 Zhu Jun
  2026-11-12  7:26 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Zhu Jun @ 2026-11-12  7:17 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, linux-kernel, Zhu Jun

usb3503_resume() ignores failures when enabling the reference clock
and restoring the hub mode. It can report a successful resume while
the hub remains unusable. A failed mode switch also leaves the clock
reference enabled.

Stop if clock preparation fails. Return the mode-switch result and
disable the clock when restoring the mode fails.

Fixes: ecdc071d02a0 ("usb: usb3503: add PM functions")
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
---
 drivers/usb/misc/usb3503.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index 9f356b4bd84e..bcc6174b80d1 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -353,10 +353,17 @@ static int __maybe_unused usb3503_suspend(struct usb3503 *hub)
 
 static int __maybe_unused usb3503_resume(struct usb3503 *hub)
 {
-	clk_prepare_enable(hub->clk);
-	usb3503_switch_mode(hub, hub->mode);
+	int ret;
 
-	return 0;
+	ret = clk_prepare_enable(hub->clk);
+	if (ret)
+		return ret;
+
+	ret = usb3503_switch_mode(hub, hub->mode);
+	if (ret)
+		clk_disable_unprepare(hub->clk);
+
+	return ret;
 }
 
 static int __maybe_unused usb3503_i2c_suspend(struct device *dev)
-- 
2.51.0




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-12  7:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12  7:17 [PATCH] usb: usb3503: Propagate resume errors and unwind the clock Zhu Jun
2026-11-12  7:26 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox