From 8262e0a6e4a91e0182ffc6b88800c6c4dbe3c020 Mon Sep 17 00:00:00 2001 From: Sarah Sharp Date: Tue, 4 Dec 2012 15:27:50 -0800 Subject: [PATCH] --- yaml --- r: 354544 b: refs/heads/master c: 2d4fa940f99663c82ba55b2244638833b388e4e2 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/usb/core/hub.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index dbf4c98859c5..03bbd9b8130c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0fe51aa5eee51db7c7ecd201d42a977ad79c58b6 +refs/heads/master: 2d4fa940f99663c82ba55b2244638833b388e4e2 diff --git a/trunk/drivers/usb/core/hub.c b/trunk/drivers/usb/core/hub.c index 855bb0d6313d..c3368f978c44 100644 --- a/trunk/drivers/usb/core/hub.c +++ b/trunk/drivers/usb/core/hub.c @@ -2584,6 +2584,9 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, return -ENOTCONN; if ((portstatus & USB_PORT_STAT_ENABLE)) { + if (!udev) + return 0; + if (hub_is_wusb(hub)) udev->speed = USB_SPEED_WIRELESS; else if (hub_is_superspeed(hub->hdev)) @@ -2627,13 +2630,15 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1, struct usb_hcd *hcd; /* TRSTRCY = 10 ms; plus some extra */ msleep(10 + 40); - update_devnum(udev, 0); - hcd = bus_to_hcd(udev->bus); - /* The xHC may think the device is already reset, - * so ignore the status. - */ - if (hcd->driver->reset_device) - hcd->driver->reset_device(hcd, udev); + if (udev) { + update_devnum(udev, 0); + hcd = bus_to_hcd(udev->bus); + /* The xHC may think the device is already + * reset, so ignore the status. + */ + if (hcd->driver->reset_device) + hcd->driver->reset_device(hcd, udev); + } } /* FALL THROUGH */ case -ENOTCONN: @@ -2647,7 +2652,7 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1, clear_port_feature(hub->hdev, port1, USB_PORT_FEAT_C_PORT_LINK_STATE); } - if (!warm) + if (!warm && udev) usb_set_device_state(udev, *status ? USB_STATE_NOTATTACHED : USB_STATE_DEFAULT);