ChangeSet 1.883.3.10, 2002/12/17 20:40:12-08:00, stern@rowland.harvard.edu

[PATCH] USB: usb-storage bugfix

Don't try to dereference the interrupt endpoint if it doesn't exist.


diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c	Wed Dec 18 00:34:41 2002
+++ b/drivers/usb/storage/usb.c	Wed Dec 18 00:34:41 2002
@@ -728,9 +728,13 @@
 			USB_ENDPOINT_NUMBER_MASK;
 		ss->ep_out = ep_out->bEndpointAddress & 
 			USB_ENDPOINT_NUMBER_MASK;
-		ss->ep_int = ep_int->bEndpointAddress & 
-			USB_ENDPOINT_NUMBER_MASK;
-		ss->ep_bInterval = ep_int->bInterval;
+		if (ep_int) {
+			ss->ep_int = ep_int->bEndpointAddress & 
+				USB_ENDPOINT_NUMBER_MASK;
+			ss->ep_bInterval = ep_int->bInterval;
+		}
+		else
+			ss->ep_int = ss->ep_bInterval = 0;
 
 		/* allocate the URB, the usb_ctrlrequest, and the IRQ URB */
 		if (usb_stor_allocate_urbs(ss))
@@ -771,9 +775,13 @@
 			USB_ENDPOINT_NUMBER_MASK;
 		ss->ep_out = ep_out->bEndpointAddress & 
 			USB_ENDPOINT_NUMBER_MASK;
-		ss->ep_int = ep_int->bEndpointAddress & 
-			USB_ENDPOINT_NUMBER_MASK;
-		ss->ep_bInterval = ep_int->bInterval;
+		if (ep_int) {
+			ss->ep_int = ep_int->bEndpointAddress & 
+				USB_ENDPOINT_NUMBER_MASK;
+			ss->ep_bInterval = ep_int->bInterval;
+		}
+		else
+			ss->ep_int = ss->ep_bInterval = 0;
 
 		/* establish the connection to the new device */
 		ss->ifnum = ifnum;
