[bug report] usb: dwc3: drd: Defer probe if extcon device is not found

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

 



Hello Andy Shevchenko,

The patch 98bba546e82d: "usb: dwc3: drd: Defer probe if extcon device
is not found" from Feb 18, 2019, leads to the following Smatch static
checker warning:

	drivers/usb/dwc3/drd.c:460 dwc3_get_extcon()
	warn: 'edev' is an error pointer or valid

drivers/usb/dwc3/drd.c
    442 static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
    443 {
    444         struct device *dev = dwc->dev;
    445         struct device_node *np_phy;
    446         struct extcon_dev *edev = NULL;
    447         const char *name;
    448 
    449         if (device_property_read_bool(dev, "extcon"))
    450                 return extcon_get_edev_by_phandle(dev, 0);
    451 
    452         /*
    453          * Device tree platforms should get extcon via phandle.
    454          * On ACPI platforms, we get the name from a device property.
    455          * This device property is for kernel internal use only and
    456          * is expected to be set by the glue code.
    457          */
    458         if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) {
    459                 edev = extcon_get_extcon_dev(name);
--> 460                 if (!edev)
    461                         return ERR_PTR(-EPROBE_DEFER);

This extcon_get_extcon_dev() returns NULL when CONFIG_EXTCON is disabled
otherwise it returns error pointers on error.  -EPROBE_DEFER does not
make sense for a .config issue.

    462 
    463                 return edev;
    464         }
    465 
    466         /*
    467          * Try to get an extcon device from the USB PHY controller's "port"
    468          * node. Check if it has the "port" node first, to avoid printing the
    469          * error message from underlying code, as it's a valid case: extcon
    470          * device (and "port" node) may be missing in case of "usb-role-switch"
    471          * or OTG mode.
    472          */
    473         np_phy = of_parse_phandle(dev->of_node, "phys", 0);
    474         if (of_graph_is_present(np_phy)) {
    475                 struct device_node *np_conn;
    476 
    477                 np_conn = of_graph_get_remote_node(np_phy, -1, -1);
    478                 if (np_conn)
    479                         edev = extcon_find_edev_by_node(np_conn);
    480                 of_node_put(np_conn);
    481         }
    482         of_node_put(np_phy);
    483 
    484         return edev;
    485 }

regards,
dan carpenter



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

  Powered by Linux