From nobody Thu Sep 24 18:41:44 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE462305660; Tue, 22 Sep 2026 00:44:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790037893; cv=none; b=C3P1d7+tVM1Jk9OWNYdAq7J0PmWnsWO+68lQLcQX+pJQ3bFR51z4JcpcVYMUC8IRK1M/irJ0F/29t3YJiRo4jdBErVxkxoyw5SWp+10TbSYW8TzfTdunSLQ+a6BFygVRcG5tp04ENE1af77BuE5/dkt5JrSGpqm10UKuQSkWfI0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790037893; c=relaxed/simple; bh=VrLlNC5NjUVGIlBg5If8kxVhB2ZN9HvHbIjY3kAZXFM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mXt3evqEcjFU7IzPWdOpDoiWQ1we3PfwNpxuBkXM9FxgSbPCBUMbko6Ws8ZRVwQqkt9/uch8Hn5OUEyb5jtyQ1ezxAhLMEeff55XnYBegTBXqN5Jlcu3ohJ6xlbp0SAstjHx+9Oy5zd4Q93oVzoSsYVoJg1j7FRuLofBLgYLBgA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=Sl6TGMZI; arc=none smtp.client-ip=220.197.31.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="Sl6TGMZI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=Co hANUA8pAKzf6hG5EKMwzcIpvCRsFVt2WMDD3wkgV0=; b=Sl6TGMZIlGVYed0tgx UKcLwoP+7qilJAKLT3mZag5yzdF0TvL+eaxOwmvum5TyGpJu2uKBbXqDHYi5CLlZ 2loQrE/3/ddtll8lKdyNDjsFVEJb4wvDtAVxwxO21k2Pggp6OTqryrRfBOXB78Q2 wKbiPC94WZf7jc0CHrOvvqYLs= Received: from localhost.localdomain (unknown []) by gzsmtp4 (Coremail) with SMTP id PygvCgCnR1Zgz7FqqM3RAg--.28552S3; Tue, 22 Sep 2026 08:44:17 +0800 (CST) From: Pengpeng Hou 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 1/3] usb: musb: omap2430: track PHY references and check initial setup Date: Tue, 22 Sep 2026 08:44:12 +0800 Message-ID: <20260922004414.4192-2-hppiscas@163.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260922004414.4192-1-hppiscas@163.com> References: <20260922004414.4192-1-hppiscas@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: PygvCgCnR1Zgz7FqqM3RAg--.28552S3 X-Coremail-Antispam: 1Uf129KBjvJXoW3WF47KFWkCryxKr1kuFWxWFg_yoWxZFWrpw 4qgayrKr4kJr9rKasxtw4UAFn5C3s3KFZrG34I9w4fur13G34qkr15AFyjvF15Grn5tFWj qF40qa1UWrs0grJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UDrcDUUUUU= X-CM-SenderInfo: 5kssx2xfdvqiywtou0bp/xtbC7QET22qxz2GM-wAA3i Content-Type: text/plain; charset="utf-8" omap2430_musb_init() ignores generic PHY initialization and power-on errors before accessing the controller. The same PHY is later acquired and released by runtime PM, system PM and platform exit. Track initialization and power references separately, and use shared helpers at all these acquisition and release sites. A failed power-on releases its initialization reference when possible; a failed release retains the corresponding ownership flag so a later cleanup does not double-release or lose track of it. Suspend failures attempt to restore the PHY before returning the original error. Abort initial setup before accessing the interface registers on failure. musb_init_controller() skips platform exit when platform init fails, so initial setup must unwind its own references. Platform exit uses the same ownership-aware release path when entered after later setup failures. Keep the PHY pointer in the parent glue, which owns the managed PHY handle, so parent removal can retry a release left by a failed child initialization or exit even after the child clears musb->phy. Keep phy_suspended as the system-sleep ordering flag: it defers access to I2C/SPI PHYs until their normal resume phase. It is not a substitute for tracking the two generic PHY reference counts. The issue was found by our static-analysis tool. Fixes: 3e3101d57c50 ("usb: musb: omap2430: use the new generic PHY framewor= k") Assisted-by: gpt 5 Signed-off-by: Pengpeng Hou --- drivers/usb/musb/omap2430.c | 105 +++++++++++++++++++++++++++++++++++++++-= ---- 1 file changed, 93 insertions(+), 12 deletions(-) diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 6e749faac33c..df807ee9deec 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -34,14 +34,71 @@ struct omap2430_glue { enum musb_vbus_id_status status; struct work_struct omap_musb_mailbox_work; struct device *control_otghs; + struct phy *phy; unsigned int is_runtime_suspended:1; unsigned int needs_resume:1; + /* Defer PHY access until the normal system-resume phase. */ unsigned int phy_suspended:1; + unsigned int phy_initialized:1; + unsigned int phy_powered:1; }; #define glue_to_musb(g) platform_get_drvdata(g->musb) =20 static struct omap2430_glue *_glue; =20 +static int omap2430_phy_power_on(struct omap2430_glue *glue) +{ + int ret; + + if (!glue->phy) + return 0; + + if (!glue->phy_initialized) { + ret =3D phy_init(glue->phy); + if (ret) + return ret; + glue->phy_initialized =3D 1; + } + + if (glue->phy_powered) + return 0; + + ret =3D phy_power_on(glue->phy); + if (ret) { + /* Keep ownership if phy_exit() itself cannot release the reference. */ + if (!phy_exit(glue->phy)) + glue->phy_initialized =3D 0; + return ret; + } + glue->phy_powered =3D 1; + + return 0; +} + +static int omap2430_phy_power_off(struct omap2430_glue *glue) +{ + int ret; + + if (!glue->phy) + return 0; + + if (glue->phy_powered) { + ret =3D phy_power_off(glue->phy); + if (ret) + return ret; + glue->phy_powered =3D 0; + } + + if (glue->phy_initialized) { + ret =3D phy_exit(glue->phy); + if (ret) + return ret; + glue->phy_initialized =3D 0; + } + + return 0; +} + static inline void omap2430_low_level_exit(struct musb *musb) { u32 l; @@ -192,6 +249,7 @@ static int omap2430_musb_init(struct musb *musb) struct device *dev =3D musb->controller; struct musb_hdrc_platform_data *plat =3D dev_get_platdata(dev); struct omap_musb_board_data *data =3D plat->board_data; + struct omap2430_glue *glue =3D dev_get_drvdata(dev->parent); =20 /* We require some kind of external transceiver, hooked * up through ULPI. TWL4030-family PMICs include one, @@ -222,8 +280,10 @@ static int omap2430_musb_init(struct musb *musb) return PTR_ERR(musb->phy); } musb->isr =3D omap2430_musb_interrupt; - phy_init(musb->phy); - phy_power_on(musb->phy); + glue->phy =3D musb->phy; + status =3D omap2430_phy_power_on(glue); + if (status) + return status; =20 l =3D musb_readl(musb->mregs, OTG_INTERFSEL); =20 @@ -272,10 +332,12 @@ static int omap2430_musb_exit(struct musb *musb) { struct device *dev =3D musb->controller; struct omap2430_glue *glue =3D dev_get_drvdata(dev->parent); + int ret; =20 omap2430_low_level_exit(musb); - phy_power_off(musb->phy); - phy_exit(musb->phy); + ret =3D omap2430_phy_power_off(glue); + if (ret) + dev_err(dev, "failed to shut down PHY: %d\n", ret); musb->phy =3D NULL; cancel_work_sync(&glue->omap_musb_mailbox_work); =20 @@ -471,9 +533,13 @@ static int omap2430_probe(struct platform_device *pdev) static void omap2430_remove(struct platform_device *pdev) { struct omap2430_glue *glue =3D platform_get_drvdata(pdev); + int ret; =20 platform_device_unregister(glue->musb); pm_runtime_disable(glue->dev); + ret =3D omap2430_phy_power_off(glue); + if (ret) + dev_err(&pdev->dev, "failed to release PHY references: %d\n", ret); if (!IS_ERR(glue->control_otghs)) put_device(glue->control_otghs); } @@ -484,6 +550,7 @@ static int omap2430_runtime_suspend(struct device *dev) { struct omap2430_glue *glue =3D dev_get_drvdata(dev); struct musb *musb =3D glue_to_musb(glue); + int ret; =20 if (!musb) return 0; @@ -494,8 +561,13 @@ static int omap2430_runtime_suspend(struct device *dev) omap2430_low_level_exit(musb); =20 if (!glue->phy_suspended) { - phy_power_off(musb->phy); - phy_exit(musb->phy); + ret =3D omap2430_phy_power_off(glue); + if (ret) { + if (omap2430_phy_power_on(glue)) + dev_err(dev, "failed to restore PHY after suspend error\n"); + omap2430_low_level_init(musb); + return ret; + } } =20 glue->is_runtime_suspended =3D 1; @@ -512,8 +584,7 @@ static int omap2430_runtime_resume(struct device *dev) return 0; =20 if (!glue->phy_suspended) { - phy_init(musb->phy); - phy_power_on(musb->phy); + omap2430_phy_power_on(glue); } =20 omap2430_low_level_init(musb); @@ -533,9 +604,17 @@ static int omap2430_suspend(struct device *dev) { struct omap2430_glue *glue =3D dev_get_drvdata(dev); struct musb *musb =3D glue_to_musb(glue); + int ret; =20 - phy_power_off(musb->phy); - phy_exit(musb->phy); + if (!musb) + return 0; + + ret =3D omap2430_phy_power_off(glue); + if (ret) { + if (omap2430_phy_power_on(glue)) + dev_err(dev, "failed to restore PHY after suspend error\n"); + return ret; + } glue->phy_suspended =3D 1; =20 return 0; @@ -571,8 +650,10 @@ static int omap2430_resume(struct device *dev) struct omap2430_glue *glue =3D dev_get_drvdata(dev); struct musb *musb =3D glue_to_musb(glue); =20 - phy_init(musb->phy); - phy_power_on(musb->phy); + if (!musb) + return 0; + + omap2430_phy_power_on(glue); glue->phy_suspended =3D 0; =20 return 0; base-commit: f0100363d8c374bd8e9ea7c9ba02744f0b802ca4 --=20 2.50.1 (Apple Git-155) From nobody Thu Sep 24 18:41:44 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 055CF344DB5; Tue, 22 Sep 2026 00:44:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.2 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790037890; cv=none; b=WqZqmu9bgZjfaXe3MM/zRuP58WTHpHXYVoNLgr/pv1ntrRora16VIYGe17Te1Nail9fR341aOZCkoJYU4pNpL3Q51/jJm7P7oH9TZ6ITrb6ghWDkeGvpALtkv06j44/fyTbVmkKPlMBueg8wdNAQoFnm9d3u1rsyACOdAqnBWR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790037890; c=relaxed/simple; bh=OapBVDM1BACiesDc4iNzC/wyazWdBFwkaUbab1prGrA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JV/i7YKEbHDO3UbeaHFOVUgMxecgTsfpHMGhm9GSR6eqnlExVU3HFwbPxCgA+/shAa3GU8eDSJBav9NBh/spWolb3YM55spb87w96pSnyKYiHehdahk/gclSx+LiavLdNWev/OwIH4hySgo0moNDUTtjF4X4Sp64LEOOnj7b/m4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=Ufzs+gA/; arc=none smtp.client-ip=117.135.210.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="Ufzs+gA/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=BV dXhhy7xNn0j7m1AF71D4qBh7abCZuY0BzyTFBCcYs=; b=Ufzs+gA/E3ocEoCjhh WUa+YBNi8++h12aM2G3L9OzmoOaSLv+T892XwM+QkxeMjcmqqk18B1tlibVKsvMv WP9cTLkDu8KdEEMGlNUFTJ9mQv77vhpFzpNoTjp6rElv/aOttZ/UqxHUtD3Al9eG OGVcN/SDdnal8n2YO7xYo+UL8= Received: from localhost.localdomain (unknown []) by gzsmtp4 (Coremail) with SMTP id PygvCgCnR1Zgz7FqqM3RAg--.28552S4; Tue, 22 Sep 2026 08:44:18 +0800 (CST) From: Pengpeng Hou 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 Message-ID: <20260922004414.4192-3-hppiscas@163.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260922004414.4192-1-hppiscas@163.com> References: <20260922004414.4192-1-hppiscas@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: PygvCgCnR1Zgz7FqqM3RAg--.28552S4 X-Coremail-Antispam: 1Uf129KBjvJXoW7WrWxKF1kZw18Gw4xZF1xAFb_yoW5Jr15pw s8Ka18Cr4kXrnrKws2yrn2qF1akws3JrZrC3sFq3s7Zr17G34qkr15uFyjyFnY9rWrJFW7 tF4UJay7ur4SqrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UgjjkUUUUU= X-CM-SenderInfo: 5kssx2xfdvqiywtou0bp/xtbCxQIT22qxz2KGYgAA3d Content-Type: text/plain; charset="utf-8" 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 --- 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 =3D glue_to_musb(glue); int error; =20 - pm_runtime_get_sync(musb->controller); + error =3D pm_runtime_resume_and_get(musb->controller); + if (error < 0) + return; =20 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 =3D dev_get_drvdata(dev); struct musb *musb =3D glue_to_musb(glue); + int ret; =20 if (!musb) return 0; =20 if (!glue->phy_suspended) { - omap2430_phy_power_on(glue); + ret =3D omap2430_phy_power_on(glue); + if (ret) + return ret; } =20 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 =3D dev_get_drvdata(dev); + int ret; =20 if (!glue->needs_resume) return 0; =20 - glue->needs_resume =3D 0; + ret =3D omap2430_runtime_resume(dev); + if (!ret) + glue->needs_resume =3D 0; =20 - return omap2430_runtime_resume(dev); + return ret; } =20 static int omap2430_resume(struct device *dev) base-commit: f0100363d8c374bd8e9ea7c9ba02744f0b802ca4 --=20 2.50.1 (Apple Git-155) From nobody Thu Sep 24 18:41:44 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8EA126ED41; Tue, 22 Sep 2026 00:44:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790037890; cv=none; b=tSH4Z3I1b/Da91oamvIwsNjlW5qf8GwyZlgdkAiDlYnIbaocUs56rvizBT8XaYbGvVV2yeLfgkMn1d64tlwWaFhRhwBdpIUVi7PPFnm8c8EIwCHhTLumwvPu9w3Uvurb+ubjS/4K6F0KQGJOiZG4jCdTB1P5/6gvlpMimb8nUnU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790037890; c=relaxed/simple; bh=6ZHWOUdWkh5+imYRzYrnoG2iop+2EzkUyqyeIpADv9k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XqeHYjQgI/zZBLjOcg8EBEgeJtpvhZtyZej+N0wPjrlr0rrJCFvH2u2OQ1H7Vl+SrLEfDablosuwtTaPk8mEYvKOEHvPpEAUnLgxw1Fz235IyOJP3qpzxVlERR/X+E1v5FpdUHRLSCvPMCuEYv5RPh6dTMfvuTHDrys4yTPMrbw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=Xtb4Jqzu; arc=none smtp.client-ip=117.135.210.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="Xtb4Jqzu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=GL gLHIwuK/H+KBkRuw2xJOrRSt4Ac8dgz8uqhNoWav4=; b=Xtb4Jqzucf5bZLmsC7 iRrvPZf1/PECpp3AfrIXoN3j1ul23FQhCRq0oranRpFlIJPhQBaJTfnqxo8Wwtt8 Pn5v9vzW2/DLymKMRIW7rgRLlzVjowzgCA0WEmgX5j9DCunNv6mB3zKIfoG258CK FXABB8NSU/SYXu5hUfRgOfVG8= Received: from localhost.localdomain (unknown []) by gzsmtp4 (Coremail) with SMTP id PygvCgCnR1Zgz7FqqM3RAg--.28552S5; Tue, 22 Sep 2026 08:44:18 +0800 (CST) From: Pengpeng Hou 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 3/3] usb: musb: omap2430: report system-resume PHY setup failures Date: Tue, 22 Sep 2026 08:44:14 +0800 Message-ID: <20260922004414.4192-4-hppiscas@163.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260922004414.4192-1-hppiscas@163.com> References: <20260922004414.4192-1-hppiscas@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: PygvCgCnR1Zgz7FqqM3RAg--.28552S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7uw1xKryUJrW5tr1UCw43Awb_yoW8WF18pr ZrKF40krWkt3Z7Ka1DtF4Iv3WrC39akrW5Cr9F9397ZrnxGa42kr15GFyjvFsYgF18tF42 yr4UAayUZF4vkFDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07U6VbPUUUUU= X-CM-SenderInfo: 5kssx2xfdvqiywtou0bp/xtbCxgMT22qxz2NPeAAA3N Content-Type: text/plain; charset="utf-8" omap2430_resume() ignores PHY setup failures and always reports success. Return the result of the ownership-aware PHY setup helper. End the system-sleep deferral even on failure: leaving phy_suspended set would make later runtime resumes skip the PHY permanently. The independent reference flags still record which resources need cleanup or retry. A later suspend or platform exit therefore releases only references actually held, while a runtime resume can retry setup without adding a second initialization reference left over from a failed cleanup. The issue was found by our static-analysis tool. Fixes: 68d9f95d6fd5 ("usb: musb: Fix suspend and resume issues for PHYs on = I2C and SPI") Assisted-by: gpt 5 Signed-off-by: Pengpeng Hou --- drivers/usb/musb/omap2430.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 382d6cd4a9e6..951e60906f2c 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -657,14 +657,16 @@ static int omap2430_resume(struct device *dev) { struct omap2430_glue *glue =3D dev_get_drvdata(dev); struct musb *musb =3D glue_to_musb(glue); + int ret; =20 if (!musb) return 0; =20 - omap2430_phy_power_on(glue); + ret =3D omap2430_phy_power_on(glue); + /* End system-sleep deferral so a later runtime resume can retry. */ glue->phy_suspended =3D 0; =20 - return 0; + return ret; } =20 static const struct dev_pm_ops omap2430_pm_ops =3D { base-commit: f0100363d8c374bd8e9ea7c9ba02744f0b802ca4 --=20 2.50.1 (Apple Git-155)