[COMMON] usb: xhci: stop xhci initialization after RPM error
authorKisang Lee <kisang80.lee@samsung.com>
Mon, 13 Aug 2018 06:07:56 +0000 (15:07 +0900)
committerhskang <hs1218.kang@samsung.com>
Mon, 13 Aug 2018 10:15:27 +0000 (06:15 -0400)
Change-Id: Ic34eca34dcf7e542e17a0fad9e7f22264478169f
Signed-off-by: Kisang Lee <kisang80.lee@samsung.com>
drivers/usb/host/xhci-plat.c

index 72817f130a2ee7781ba92cb225205fa114a42e1c..d44bcdf6882a63bec9d3478e712a531648f2981b 100644 (file)
@@ -320,7 +320,11 @@ static int xhci_plat_probe(struct platform_device *pdev)
                        return ret;
        }
 
-       pm_runtime_set_active(&pdev->dev);
+       ret = pm_runtime_set_active(&pdev->dev);
+       if (ret != 0) {
+               pr_err("USB can't enable runtime pm (%d)\n", ret);
+               goto runtime_pm_err;
+       }
        pm_runtime_enable(&pdev->dev);
        pm_runtime_get_noresume(&pdev->dev);
 
@@ -501,6 +505,7 @@ disable_runtime:
        pm_runtime_put_noidle(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
 
+runtime_pm_err:
        return ret;
 }
 
@@ -532,12 +537,12 @@ static int xhci_plat_remove(struct platform_device *dev)
        }
        xhci_dbg(xhci, "%s: waited %dmsec", __func__, timeout);
 
+       xhci->xhc_state |= XHCI_STATE_REMOVING;
+
        dev_info(&dev->dev, "WAKE UNLOCK\n");
        wake_unlock(xhci->wakelock);
        wake_lock_destroy(xhci->wakelock);
 
-       xhci->xhc_state |= XHCI_STATE_REMOVING;
-
        usb_remove_hcd(xhci->shared_hcd);
        usb_phy_shutdown(hcd->usb_phy);