aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2015-02-17 05:31:29 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-20 15:21:31 -0500
commit64bea46e3ff28701aa34be48b93c7907ebbdb31e (patch)
treea5ee06acd18dba3fefc00f7773e24b44f7e9b1a6 /drivers
parent216fa18f339e9e006a93cacb54884348da668b9e (diff)
hso: always read interface number from the current altsetting
Always read bInterfaceNumber from the current altsetting, not from the first one available in the altsetting array. This is coming from code review, not related to any specific bug. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/usb/hso.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 9cdfb3fe9c15..3c8dfe5e46ed 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1477,6 +1477,7 @@ static void tiocmget_intr_callback(struct urb *urb)
1477 struct uart_icount *icount; 1477 struct uart_icount *icount;
1478 struct hso_serial_state_notification *serial_state_notification; 1478 struct hso_serial_state_notification *serial_state_notification;
1479 struct usb_device *usb; 1479 struct usb_device *usb;
1480 struct usb_interface *interface;
1480 int if_num; 1481 int if_num;
1481 1482
1482 /* Sanity checks */ 1483 /* Sanity checks */
@@ -1494,7 +1495,9 @@ static void tiocmget_intr_callback(struct urb *urb)
1494 BUG_ON((serial->parent->port_spec & HSO_PORT_MASK) != HSO_PORT_MODEM); 1495 BUG_ON((serial->parent->port_spec & HSO_PORT_MASK) != HSO_PORT_MODEM);
1495 1496
1496 usb = serial->parent->usb; 1497 usb = serial->parent->usb;
1497 if_num = serial->parent->interface->altsetting->desc.bInterfaceNumber; 1498 interface = serial->parent->interface;
1499
1500 if_num = interface->cur_altsetting->desc.bInterfaceNumber;
1498 1501
1499 /* wIndex should be the USB interface number of the port to which the 1502 /* wIndex should be the USB interface number of the port to which the
1500 * notification applies, which should always be the Modem port. 1503 * notification applies, which should always be the Modem port.
@@ -1675,6 +1678,7 @@ static int hso_serial_tiocmset(struct tty_struct *tty,
1675 unsigned long flags; 1678 unsigned long flags;
1676 int if_num; 1679 int if_num;
1677 struct hso_serial *serial = tty->driver_data; 1680 struct hso_serial *serial = tty->driver_data;
1681 struct usb_interface *interface;
1678 1682
1679 /* sanity check */ 1683 /* sanity check */
1680 if (!serial) { 1684 if (!serial) {
@@ -1685,7 +1689,8 @@ static int hso_serial_tiocmset(struct tty_struct *tty,
1685 if ((serial->parent->port_spec & HSO_PORT_MASK) != HSO_PORT_MODEM) 1689 if ((serial->parent->port_spec & HSO_PORT_MASK) != HSO_PORT_MODEM)
1686 return -EINVAL; 1690 return -EINVAL;
1687 1691
1688 if_num = serial->parent->interface->altsetting->desc.bInterfaceNumber; 1692 interface = serial->parent->interface;
1693 if_num = interface->cur_altsetting->desc.bInterfaceNumber;
1689 1694
1690 spin_lock_irqsave(&serial->serial_lock, flags); 1695 spin_lock_irqsave(&serial->serial_lock, flags);
1691 if (set & TIOCM_RTS) 1696 if (set & TIOCM_RTS)
@@ -2808,7 +2813,7 @@ static int hso_get_config_data(struct usb_interface *interface)
2808{ 2813{
2809 struct usb_device *usbdev = interface_to_usbdev(interface); 2814 struct usb_device *usbdev = interface_to_usbdev(interface);
2810 u8 *config_data = kmalloc(17, GFP_KERNEL); 2815 u8 *config_data = kmalloc(17, GFP_KERNEL);
2811 u32 if_num = interface->altsetting->desc.bInterfaceNumber; 2816 u32 if_num = interface->cur_altsetting->desc.bInterfaceNumber;
2812 s32 result; 2817 s32 result;
2813 2818
2814 if (!config_data) 2819 if (!config_data)
@@ -2886,7 +2891,7 @@ static int hso_probe(struct usb_interface *interface,
2886 return -ENODEV; 2891 return -ENODEV;
2887 } 2892 }
2888 2893
2889 if_num = interface->altsetting->desc.bInterfaceNumber; 2894 if_num = interface->cur_altsetting->desc.bInterfaceNumber;
2890 2895
2891 /* Get the interface/port specification from either driver_info or from 2896 /* Get the interface/port specification from either driver_info or from
2892 * the device itself */ 2897 * the device itself */