usb: dwc3: unregister extcon notify if probe fail
authorMeng Dongyang <daniel.meng@rock-chips.com>
Sun, 25 Sep 2016 07:48:29 +0000 (15:48 +0800)
committerMeng Dongyang <daniel.meng@rock-chips.com>
Sun, 25 Sep 2016 08:12:08 +0000 (16:12 +0800)
When the pointer of hcd is NULL, dwc3 driver will probe again. In this
case the notify sync function will issue "Bad mode in Synchronous Abort
handler detected" error if the extcon notify is not unregisted before
next probe. This patch add unregister extcon notify function and
unregister extcon notify when hcd is NULL.

Change-Id: Id55ce4280518e0c7e36a64133e38189bb4a7d29e
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
drivers/usb/dwc3/dwc3-rockchip.c

index 6f549b58b209fb0d8b6fb3350fce81a4133f11f7..656a00c72ab1ba34890fa51d124ae3912e4b6ab2 100644 (file)
@@ -335,7 +335,7 @@ static int dwc3_rockchip_probe(struct platform_device *pdev)
                        if (!hcd) {
                                dev_err(dev, "fail to get drvdata hcd\n");
                                ret = -EPROBE_DEFER;
-                               goto err2;
+                               goto err3;
                        }
                        if (hcd->state != HC_STATE_HALT) {
                                usb_remove_hcd(hcd->shared_hcd);
@@ -354,6 +354,9 @@ static int dwc3_rockchip_probe(struct platform_device *pdev)
 
        return ret;
 
+err3:
+       dwc3_rockchip_extcon_unregister(rockchip);
+
 err2:
        of_platform_depopulate(dev);