usb: chipidea: core: do not register extcon notifier if extcon device is not existed
authorPeter Chen <peter.chen@nxp.com>
Fri, 23 Jun 2017 06:39:27 +0000 (14:39 +0800)
committerPeter Chen <peter.chen@nxp.com>
Tue, 25 Jul 2017 07:22:44 +0000 (15:22 +0800)
This issue is detected when the system has another device driver
which registers USB connector extcon device, fix it by adding
extcon device check.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
drivers/usb/chipidea/core.c

index b17ed3a9a3045ff9d9c88aacca3d8b1ffc98a06e..a91736bfc5c282b06e67746e1e1f4100b14f5be8 100644 (file)
@@ -736,7 +736,7 @@ static int ci_extcon_register(struct ci_hdrc *ci)
 
        id = &ci->platdata->id_extcon;
        id->ci = ci;
-       if (!IS_ERR(id->edev)) {
+       if (!IS_ERR_OR_NULL(id->edev)) {
                ret = devm_extcon_register_notifier(ci->dev, id->edev,
                                                EXTCON_USB_HOST, &id->nb);
                if (ret < 0) {
@@ -747,7 +747,7 @@ static int ci_extcon_register(struct ci_hdrc *ci)
 
        vbus = &ci->platdata->vbus_extcon;
        vbus->ci = ci;
-       if (!IS_ERR(vbus->edev)) {
+       if (!IS_ERR_OR_NULL(vbus->edev)) {
                ret = devm_extcon_register_notifier(ci->dev, vbus->edev,
                                                EXTCON_USB, &vbus->nb);
                if (ret < 0) {