ub: Bind to first endpoint, not to last
authorPete Zaitcev <zaitcev@redhat.com>
Fri, 9 Mar 2007 03:56:23 +0000 (19:56 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 27 Apr 2007 20:28:34 +0000 (13:28 -0700)
The usb-storage switched to binding to first endpoint recently. Apparently,
there are devices out there with extra endpoints. It is perfectly legal.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/block/ub.c

index 2098eff91e14721641f81c47b3c510481fbb6bcc..746a118a9b52ba1792b28861605902534290d1d4 100644 (file)
@@ -2132,10 +2132,13 @@ static int ub_get_pipes(struct ub_dev *sc, struct usb_device *dev,
                if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
                                == USB_ENDPOINT_XFER_BULK) {
                        /* BULK in or out? */
-                       if (ep->bEndpointAddress & USB_DIR_IN)
-                               ep_in = ep;
-                       else
-                               ep_out = ep;
+                       if (ep->bEndpointAddress & USB_DIR_IN) {
+                               if (ep_in == NULL)
+                                       ep_in = ep;
+                       } else {
+                               if (ep_out == NULL)
+                                       ep_out = ep;
+                       }
                }
        }