diff options
author | Peter Chen <peter.chen@freescale.com> | 2013-12-10 17:45:44 +0800 |
---|---|---|
committer | Anthony Felice <tony.felice@timesys.com> | 2014-01-16 15:54:04 -0500 |
commit | 1aa6b2c7e4b030f5319d05aaa4de520595ed92b2 (patch) | |
tree | 5897c059e640096ea1a1eaad66f50c2e3dd14aaa | |
parent | ce924a53db49cb570f7b481981d488ba8e270828 (diff) |
usb: core: fix two problems for unsupported devices3.0-vybrid-ts2.12
- NULL pointer after removing unsupported devices
- only print "hub 2-0:1.0: port 1 nyet suspended" for
device who has enumerated successfully
Signed-off-by: Peter Chen <peter.chen@freescale.com>
-rw-r--r-- | drivers/usb/core/hub.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 16a790826fbb..ea6cd7feea01 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1739,7 +1739,18 @@ void usb_disconnect(struct usb_device **pdev) * for de-configuring the device and invoking the remove-device * notifier chain (used by usbfs and possibly others). */ - device_del(&udev->dev); +/* device_del(&udev->dev); */ + /* If error occur during enumeration, maybe the device_add + * will not call at all, so we need to identify whether this + * device has been added or not, here we use dev.driver to + * tell it + */ + if (udev->dev.driver) { + device_del(&udev->dev); + printk(KERN_DEBUG "device_del called\n"); + } else { + printk(KERN_DEBUG "device_del not need to call\n"); + } /* Free the device number and delete the parent's children[] * (or root_hub) pointer. @@ -2696,7 +2707,7 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg) struct usb_device *udev; udev = hdev->children [port1-1]; - if (udev && udev->can_submit) { + if (udev && udev->can_submit && udev->dev.driver) { dev_warn(&intf->dev, "port %d nyet suspended\n", port1); if (msg.event & PM_EVENT_AUTO) return -EBUSY; |