]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: dwc3: drd: Defer probe if extcon device is not found
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 18 Feb 2019 13:26:31 +0000 (15:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Feb 2019 14:08:07 +0000 (15:08 +0100)
In case the "linux,extcon-name" property is defined but device itself
is not ready, defer the probe.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/drd.c

index 869725d15c7493126f8b0140e0dc28a92d95f529..726100d1ac0d8070e2b0dc2341c80886d1d3f814 100644 (file)
@@ -457,8 +457,13 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
         * This device property is for kernel internal use only and
         * is expected to be set by the glue code.
         */
-       if (device_property_read_string(dev, "linux,extcon-name", &name) == 0)
-               return extcon_get_extcon_dev(name);
+       if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) {
+               edev = extcon_get_extcon_dev(name);
+               if (!edev)
+                       return ERR_PTR(-EPROBE_DEFER);
+
+               return edev;
+       }
 
        np_phy = of_parse_phandle(dev->of_node, "phys", 0);
        np_conn = of_graph_get_remote_node(np_phy, -1, -1);