[PATCH] USB: chipidea: fix error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



devm_usb_get_phy_by_phandle() returns a PTR_ERR on failure, so we have
to check for IS_ERR before calling usb_phy_shutdown(), not for NULL.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
Cc: Peter Chen <peter.chen@xxxxxxxxxxxxx>
Cc: linux-usb@xxxxxxxxxxxxxxx
---
 drivers/usb/chipidea/ci_hdrc_imx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index be822a2..1b7ffc9 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -165,7 +165,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
 disable_device:
 	ci_hdrc_remove_device(data->ci_pdev);
 err_phy:
-	if (data->phy)
+	if (!IS_ERR(data->phy))
 		usb_phy_shutdown(data->phy);
 err_clk:
 	clk_disable_unprepare(data->clk);
@@ -179,7 +179,7 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 	ci_hdrc_remove_device(data->ci_pdev);
 
-	if (data->phy)
+	if (!IS_ERR(data->phy))
 		usb_phy_shutdown(data->phy);
 
 	clk_disable_unprepare(data->clk);
-- 
1.8.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux