All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pengpeng Hou <hppiscas@163.com>
To: Bin Liu <b-liu@ti.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Pengpeng Hou <hppiscas@163.com>, Tony Lindgren <tony@atomide.com>,
	linux-usb@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] usb: musb: omap2430: Propagate PHY errors from system resume
Date: Sun,  6 Sep 2026 11:41:49 +0800	[thread overview]
Message-ID: <20260906034149.85550-4-hppiscas@163.com> (raw)

omap2430_resume() ignores phy_init() and phy_power_on() failures and
clears phy_suspended even when the PHY is not usable.

Return initialization errors and call phy_exit() when power-on fails
after a successful initialization. Clear phy_suspended only after both
operations succeed.

The issue was found by our static-analysis tool and manually reviewed.

Fixes: 68d9f95d6fd5 ("usb: musb: Fix suspend and resume issues for PHYs on I2C and SPI")
Assisted-by: gpt 5
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
 drivers/usb/musb/omap2430.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index f881455a1a23..d95ffe7a2bfb 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -585,9 +585,17 @@ static int omap2430_resume(struct device *dev)
 {
 	struct omap2430_glue *glue = dev_get_drvdata(dev);
 	struct musb *musb = glue_to_musb(glue);
+	int ret;
+
+	ret = phy_init(musb->phy);
+	if (ret)
+		return ret;
 
-	phy_init(musb->phy);
-	phy_power_on(musb->phy);
+	ret = phy_power_on(musb->phy);
+	if (ret) {
+		phy_exit(musb->phy);
+		return ret;
+	}
 	glue->phy_suspended = 0;
 
 	return 0;
-- 
2.50.1 (Apple Git-155)


                 reply	other threads:[~2026-09-06  3:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260906034149.85550-4-hppiscas@163.com \
    --to=hppiscas@163.com \
    --cc=b-liu@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.