mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-06 11:54:14 -04:00
usb: chipidea: ci_hdrc_imx: implement usb_phy_init() error handling
[ Upstream commit 8c531e0a8c2d82509ad97c6d3a1e6217c7ed136d ]
usb_phy_init() may return an error code if e.g. its implementation fails
to prepare/enable some clocks. And properly rollback on probe error path
by calling the counterpart usb_phy_shutdown().
Found by Linux Verification Center (linuxtesting.org).
Fixes: be9cae2479 ("usb: chipidea: imx: Fix ULPI on imx53")
Cc: stable <stable@kernel.org>
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Acked-by: Peter Chen <peter.chen@kernel.org>
Link: https://lore.kernel.org/r/20250316102658.490340-4-pchelkin@ispras.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
b8feb22ee5
commit
d086cca921
1 changed files with 10 additions and 3 deletions
|
|
@ -417,7 +417,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
|
|||
of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI) {
|
||||
pdata.flags |= CI_HDRC_OVERRIDE_PHY_CONTROL;
|
||||
data->override_phy_control = true;
|
||||
usb_phy_init(pdata.usb_phy);
|
||||
ret = usb_phy_init(pdata.usb_phy);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to init phy\n");
|
||||
goto err_clk;
|
||||
}
|
||||
}
|
||||
|
||||
if (pdata.flags & CI_HDRC_SUPPORTS_RUNTIME_PM)
|
||||
|
|
@ -426,7 +430,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
|
|||
ret = imx_usbmisc_init(data->usbmisc_data);
|
||||
if (ret) {
|
||||
dev_err(dev, "usbmisc init failed, ret=%d\n", ret);
|
||||
goto err_clk;
|
||||
goto phy_shutdown;
|
||||
}
|
||||
|
||||
data->ci_pdev = ci_hdrc_add_device(dev,
|
||||
|
|
@ -435,7 +439,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(data->ci_pdev)) {
|
||||
ret = PTR_ERR(data->ci_pdev);
|
||||
dev_err_probe(dev, ret, "ci_hdrc_add_device failed\n");
|
||||
goto err_clk;
|
||||
goto phy_shutdown;
|
||||
}
|
||||
|
||||
ret = imx_usbmisc_init_post(data->usbmisc_data);
|
||||
|
|
@ -455,6 +459,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
|
|||
|
||||
disable_device:
|
||||
ci_hdrc_remove_device(data->ci_pdev);
|
||||
phy_shutdown:
|
||||
if (data->override_phy_control)
|
||||
usb_phy_shutdown(data->phy);
|
||||
err_clk:
|
||||
imx_disable_unprepare_clks(dev);
|
||||
disable_hsic_regulator:
|
||||
|
|
|
|||
Loading…
Reference in a new issue