mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 11:03:43 +02:00
usb: dwc3: xilinx: fix error handling in zynqmp init error paths
Fix error handling and resource cleanup i.e remove invalid
phy_exit() after failed phy_init(), route failures through
proper cleanup paths and return 0 explicitly on success.
Fixes: 84770f028f ("usb: dwc3: Add driver for Xilinx platforms")
Cc: stable@vger.kernel.org
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Link: https://patch.msgid.link/20260519115529.2980421-1-radhey.shyam.pandey@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
288a81a850
commit
c1a0ecbf32
|
|
@ -184,15 +184,13 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
|
|||
}
|
||||
|
||||
ret = phy_init(priv_data->usb3_phy);
|
||||
if (ret < 0) {
|
||||
phy_exit(priv_data->usb3_phy);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = reset_control_deassert(apbrst);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to release APB reset\n");
|
||||
goto err;
|
||||
goto err_phy_exit;
|
||||
}
|
||||
|
||||
if (priv_data->usb3_phy) {
|
||||
|
|
@ -208,26 +206,24 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
|
|||
ret = reset_control_deassert(crst);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to release core reset\n");
|
||||
goto err;
|
||||
goto err_phy_exit;
|
||||
}
|
||||
|
||||
ret = reset_control_deassert(hibrst);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to release hibernation reset\n");
|
||||
goto err;
|
||||
goto err_phy_exit;
|
||||
}
|
||||
|
||||
ret = phy_power_on(priv_data->usb3_phy);
|
||||
if (ret < 0) {
|
||||
phy_exit(priv_data->usb3_phy);
|
||||
goto err;
|
||||
}
|
||||
if (ret < 0)
|
||||
goto err_phy_exit;
|
||||
|
||||
/* ulpi reset via gpio-modepin or gpio-framework driver */
|
||||
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
|
||||
if (IS_ERR(reset_gpio)) {
|
||||
return dev_err_probe(dev, PTR_ERR(reset_gpio),
|
||||
"Failed to request reset GPIO\n");
|
||||
ret = PTR_ERR(reset_gpio);
|
||||
goto err_phy_power_off;
|
||||
}
|
||||
|
||||
if (reset_gpio) {
|
||||
|
|
@ -237,6 +233,13 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
|
|||
}
|
||||
|
||||
dwc3_xlnx_set_coherency(priv_data, XLNX_USB_TRAFFIC_ROUTE_CONFIG);
|
||||
|
||||
return 0;
|
||||
|
||||
err_phy_power_off:
|
||||
phy_power_off(priv_data->usb3_phy);
|
||||
err_phy_exit:
|
||||
phy_exit(priv_data->usb3_phy);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user