Skip to content

Commit 2cc9b1c

Browse files
robhancocksedgregkh
authored andcommitted
usb: dwc3: xilinx: Fix error handling when getting USB3 PHY
The code that looked up the USB3 PHY was ignoring all errors other than EPROBE_DEFER in an attempt to handle the PHY not being present. Fix and simplify the code by using devm_phy_optional_get and dev_err_probe so that a missing PHY is not treated as an error and unexpected errors are handled properly. Fixes: 84770f0 ("usb: dwc3: Add driver for Xilinx platforms") Cc: stable <[email protected]> Signed-off-by: Robert Hancock <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9678f33 commit 2cc9b1c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/usb/dwc3/dwc3-xilinx.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
102102
int ret;
103103
u32 reg;
104104

105-
usb3_phy = devm_phy_get(dev, "usb3-phy");
106-
if (PTR_ERR(usb3_phy) == -EPROBE_DEFER) {
107-
ret = -EPROBE_DEFER;
105+
usb3_phy = devm_phy_optional_get(dev, "usb3-phy");
106+
if (IS_ERR(usb3_phy)) {
107+
ret = PTR_ERR(usb3_phy);
108+
dev_err_probe(dev, ret,
109+
"failed to get USB3 PHY\n");
108110
goto err;
109-
} else if (IS_ERR(usb3_phy)) {
110-
usb3_phy = NULL;
111111
}
112112

113113
/*

0 commit comments

Comments
 (0)