summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-03-16 17:13:39 +0100
committerJohan Hovold <johan@kernel.org>2017-03-28 11:00:09 +0200
commit03b72aecadc2d7b0e8f200ec70b853e39a7e55da (patch)
tree9cc708a4d51f6d9eccbcbdf819ccab7cd2a861be /drivers/usb/serial
parent2f16621b9a06c1956eba57a23ff990bd24ceee82 (diff)
downloadlinux-03b72aecadc2d7b0e8f200ec70b853e39a7e55da.tar.bz2
USB: serial: ipaq: use calc_num_endpoints to verify endpoints
Use the calc_num_ports rather than attach callback to determine which interface to bind to in order to avoid allocating port-resources for interfaces that won't be bound. Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/ipaq.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index df5f1a7d7c6f..c638571f0175 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -574,20 +574,22 @@ static int ipaq_calc_num_ports(struct usb_serial *serial,
ipaq_num_ports = 2;
}
+ /*
+ * Some of the devices in ipaq_id_table[] are composite, and we
+ * shouldn't bind to all the interfaces. This test will rule out
+ * some obviously invalid possibilities.
+ */
+ if (epds->num_bulk_in < ipaq_num_ports ||
+ epds->num_bulk_out < ipaq_num_ports) {
+ return -ENODEV;
+ }
+
return ipaq_num_ports;
}
static int ipaq_startup(struct usb_serial *serial)
{
- /* Some of the devices in ipaq_id_table[] are composite, and we
- * shouldn't bind to all the interfaces. This test will rule out
- * some obviously invalid possibilities.
- */
- if (serial->num_bulk_in < serial->num_ports ||
- serial->num_bulk_out < serial->num_ports)
- return -ENODEV;
-
if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
/*
* FIXME: HP iPaq rx3715, possibly others, have 1 config that