Re: [PATCH v2] USB: ehci-omap: Fix missing usb_phy_init() error handling

From: Greg KH

Date: Wed Dec 17 2025 - 12:19:55 EST


On Wed, Dec 03, 2025 at 11:28:22AM +0800, Haotian Zhang wrote:
> usb_phy_init() may fail if the PHY clock or regulator setup fails,
> but ehci_hcd_omap_probe() does not check its return value,
> potentially causing later operations to act on an uninitialized PHY.
> Original cleanup also calls usb_phy_shutdown() on uninitialized
> PHYs, which is unsafe.
>
> Add proper error checking for usb_phy_init() calls. Add a new
> error label to properly remove the hcd. Use local bool array to
> track successfully initialized PHYs, only shutdown properly
> initialized PHYs during cleanup.
>
> Fixes: 4e5c9e6fa2d2 ("USB: ehci-omap: Tweak PHY initialization sequence")
> Fixes: 49f092198f4f ("USB: ehci-omap: Fix detection in HSIC mode")
> Suggested-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Haotian Zhang <vulab@xxxxxxxxxxx>
> ---
> Changes in v2:
> -Add a local bool array to track successfully initialized PHYs.
> -Check if PHY is successfully initialized before
> calling usb_phy_shutdown().
> ---
> drivers/usb/host/ehci-omap.c | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)

Again, how was this found and tested?

thanks,

greg k-h