From: Pengpeng Hou <hppiscas@163.com>
To: b-liu@ti.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
s.nawrocki@samsung.com, kishon@kernel.org, balbi@ti.com,
tony@atomide.com, hppiscas@163.com
Subject: [PATCH v2 2/3] usb: musb: omap2430: stop runtime resume after PHY setup failure
Date: Tue, 22 Sep 2026 08:44:13 +0800 [thread overview]
Message-ID: <20260922004414.4192-3-hppiscas@163.com> (raw)
In-Reply-To: <20260922004414.4192-1-hppiscas@163.com>
omap2430_runtime_resume() continues restoring the glue registers and
clears is_runtime_suspended even when generic PHY setup fails.
Return the setup error before accessing those registers or publishing
the resumed state. Also stop mailbox processing if its runtime-PM get
fails, rather than treating an unsuccessful resume as access permission.
pm_runtime_resume_and_get() balances its usage reference on failure.
Keep needs_resume set until the early system-resume operation succeeds.
The normal system-resume phase remains responsible for I2C/SPI PHYs.
The issue was found by our static-analysis tool.
Fixes: 10ac7e7757f5 ("usb: musb: omap2430: Add support for idling phy when musb is idle")
Assisted-by: gpt 5
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
drivers/usb/musb/omap2430.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index df807ee9deec..382d6cd4a9e6 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -150,7 +150,9 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
struct musb *musb = glue_to_musb(glue);
int error;
- pm_runtime_get_sync(musb->controller);
+ error = pm_runtime_resume_and_get(musb->controller);
+ if (error < 0)
+ return;
dev_dbg(musb->controller, "VBUS %s, devctl %02x\n",
usb_otg_state_string(musb->xceiv->otg->state),
@@ -579,12 +581,15 @@ static int omap2430_runtime_resume(struct device *dev)
{
struct omap2430_glue *glue = dev_get_drvdata(dev);
struct musb *musb = glue_to_musb(glue);
+ int ret;
if (!musb)
return 0;
if (!glue->phy_suspended) {
- omap2430_phy_power_on(glue);
+ ret = omap2430_phy_power_on(glue);
+ if (ret)
+ return ret;
}
omap2430_low_level_init(musb);
@@ -636,13 +641,16 @@ static int omap2430_suspend_late(struct device *dev)
static int omap2430_resume_early(struct device *dev)
{
struct omap2430_glue *glue = dev_get_drvdata(dev);
+ int ret;
if (!glue->needs_resume)
return 0;
- glue->needs_resume = 0;
+ ret = omap2430_runtime_resume(dev);
+ if (!ret)
+ glue->needs_resume = 0;
- return omap2430_runtime_resume(dev);
+ return ret;
}
static int omap2430_resume(struct device *dev)
base-commit: f0100363d8c374bd8e9ea7c9ba02744f0b802ca4
--
2.50.1 (Apple Git-155)
next prev parent reply other threads:[~2026-09-22 0:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 0:44 [PATCH v2 0/3] usb: musb: omap2430: handle PHY setup failures across PM Pengpeng Hou
2026-09-22 0:44 ` [PATCH v2 1/3] usb: musb: omap2430: track PHY references and check initial setup Pengpeng Hou
2026-09-22 0:44 ` Pengpeng Hou [this message]
2026-09-22 0:44 ` [PATCH v2 3/3] usb: musb: omap2430: report system-resume PHY setup failures Pengpeng Hou
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=20260922004414.4192-3-hppiscas@163.com \
--to=hppiscas@163.com \
--cc=b-liu@ti.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=kishon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=s.nawrocki@samsung.com \
--cc=tony@atomide.com \
/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®