ChangeSet 1.1315.8.11, 2003/09/16 13:42:41-07:00, stern@rowland.harvard.edu

[PATCH] USB: Use num_altsetting in usbnet and usbtest

This patch fixes usbnet and usbtest.  When checking endpoints, they
iterate through all interfaces out to intf->max_altsetting, but they
should only go up to intf->num_altsetting.  The max_altsetting value
refers to the amount of space _allocated_ for usb_host_interface
structures, not the number that are really in use.


 drivers/usb/misc/usbtest.c |    2 +-
 drivers/usb/net/usbnet.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


diff -Nru a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
--- a/drivers/usb/misc/usbtest.c	Fri Sep 19 17:13:27 2003
+++ b/drivers/usb/misc/usbtest.c	Fri Sep 19 17:13:27 2003
@@ -87,7 +87,7 @@
 	struct usb_host_endpoint	*in, *out;
 	struct usb_device		*udev;
 
-	for (tmp = 0; tmp < intf->max_altsetting; tmp++) {
+	for (tmp = 0; tmp < intf->num_altsetting; tmp++) {
 		unsigned	ep;
 
 		in = out = 0;
diff -Nru a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
--- a/drivers/usb/net/usbnet.c	Fri Sep 19 17:13:27 2003
+++ b/drivers/usb/net/usbnet.c	Fri Sep 19 17:13:27 2003
@@ -312,7 +312,7 @@
 	struct usb_host_interface	*alt;
 	struct usb_host_endpoint	*in, *out;
 
-	for (tmp = 0; tmp < intf->max_altsetting; tmp++) {
+	for (tmp = 0; tmp < intf->num_altsetting; tmp++) {
 		unsigned	ep;
 
 		in = out = 0;
