From b40b7a905ce57608ca93c5032d5ab1f5508d2f11 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 19 Jun 2006 15:12:38 -0400 Subject: [PATCH] USB hub: don't return status > 0 from resume finish_device_resume() in the hub driver isn't careful always to return a negative code in all the error pathways. It also doesn't return 0 in all the success pathways. This patch (as724) fixes the behavior. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/usb/core/hub.c') diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 875596e98e4..41531bba432 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1790,7 +1790,10 @@ static int finish_device_resume(struct usb_device *udev) * and device drivers will know about any resume quirks. */ status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); - if (status < 2) + if (status >= 0) + status = (status == 2 ? 0 : -ENODEV); + + if (status) dev_dbg(&udev->dev, "gone after usb resume? status %d\n", status); -- cgit v1.2.3 From 20307949469269ceea6262aaa306dcb55cf43b25 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Wed, 28 Jun 2006 11:20:41 -0400 Subject: [PATCH] usbcore: fixes for hub_port_resume This patch (as731) makes a couple of small fixes to the hub_port_resume routine: Don't return status >= 0 when an error occurs; Clear the port-change-suspend status indicator after resuming a device. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/usb/core/hub.c') diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 41531bba432..26c8cb5f3e6 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1882,7 +1882,12 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev) dev_dbg(hub->intfdev, "port %d status %04x.%04x after resume, %d\n", port1, portchange, devstatus, status); + if (status >= 0) + status = -ENODEV; } else { + if (portchange & USB_PORT_STAT_C_SUSPEND) + clear_port_feature(hub->hdev, port1, + USB_PORT_FEAT_C_SUSPEND); /* TRSMRCY = 10 msec */ msleep(10); if (udev) -- cgit v1.2.3