Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1639410
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3.18 28/39] USB: serial: sierra: fix bogus alternate-setting assumption |
| Date | 2017-05-11 15:10 +0200 |
| Message-ID | <tFW0Y-6HP-73@gated-at.bofh.it> (permalink) |
| References | <tFW0W-6HP-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
commit 16620b483eaf7750413bae472f4363b6b959fcaa upstream.
Interface numbers do not change when enabling alternate settings as
comment and code in this driver suggested.
Remove the confusing comment and redundant retrieval of the interface
number in probe, while simplifying and renaming the interface-number
helper.
Fixes: 4db2299da213 ("sierra: driver interface blacklisting")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/sierra.c | 28 +++++-----------------------
1 file changed, 5 insertions(+), 23 deletions(-)
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -137,24 +137,9 @@ static int is_himemory(const u8 ifnum,
return 0;
}
-static int sierra_calc_interface(struct usb_serial *serial)
+static u8 sierra_interface_num(struct usb_serial *serial)
{
- int interface;
- struct usb_interface *p_interface;
- struct usb_host_interface *p_host_interface;
-
- /* Get the interface structure pointer from the serial struct */
- p_interface = serial->interface;
-
- /* Get a pointer to the host interface structure */
- p_host_interface = p_interface->cur_altsetting;
-
- /* read the interface descriptor for this active altsetting
- * to find out the interface number we are on
- */
- interface = p_host_interface->desc.bInterfaceNumber;
-
- return interface;
+ return serial->interface->cur_altsetting->desc.bInterfaceNumber;
}
static int sierra_probe(struct usb_serial *serial,
@@ -165,7 +150,7 @@ static int sierra_probe(struct usb_seria
u8 ifnum;
udev = serial->dev;
- ifnum = sierra_calc_interface(serial);
+ ifnum = sierra_interface_num(serial);
/*
* If this interface supports more than 1 alternate
@@ -178,9 +163,6 @@ static int sierra_probe(struct usb_seria
usb_set_interface(udev, ifnum, 1);
}
- /* ifnum could have changed - by calling usb_set_interface */
- ifnum = sierra_calc_interface(serial);
-
if (is_blacklisted(ifnum,
(struct sierra_iface_info *)id->driver_info)) {
dev_dbg(&serial->dev->dev,
@@ -342,7 +324,7 @@ static int sierra_send_setup(struct usb_
/* If composite device then properly report interface */
if (serial->num_ports == 1) {
- interface = sierra_calc_interface(serial);
+ interface = sierra_interface_num(serial);
/* Control message is sent only to interfaces with
* interrupt_in endpoints
*/
@@ -916,7 +898,7 @@ static int sierra_port_probe(struct usb_
/* Determine actual memory requirements */
if (serial->num_ports == 1) {
/* Get interface number for composite device */
- ifnum = sierra_calc_interface(serial);
+ ifnum = sierra_interface_num(serial);
himemoryp = &typeB_interface_list;
} else {
/* This is really the usb-serial port number of the interface
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3.18 00/39] 3.18.53-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200 [PATCH 3.18 28/39] USB: serial: sierra: fix bogus alternate-setting assumption Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200 [PATCH 3.18 18/39] USB: serial: keyspan_pda: fix receive sanity checks Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200 [PATCH 3.18 34/39] ipv4, ipv6: ensure raw socket message is big enough to hold an IP header Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200 [PATCH 3.18 10/39] mwifiex: debugfs: Fix (sometimes) off-by-1 SSID print Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200 [PATCH 3.18 31/39] brcmfmac: Make skb header writable before use Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200 [PATCH 3.18 26/39] USB: serial: mct_u232: fix modem-status error handling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200 [PATCH 3.18 03/39] mtd: cfi: reduce stack size Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200 [PATCH 3.18 06/39] powerpc/powernv: Fix opal_exit tracepoint opcode Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:20 +0200 [PATCH 3.18 05/39] cpupower: Fix turbo frequency reporting for pre-Sandy Bridge cores Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:20 +0200 [PATCH 3.18 09/39] ARM: OMAP5 / DRA7: Fix HYP mode boot for thumb2 build Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:20 +0200 [PATCH 3.18 20/39] USB: serial: ssu100: fix control-message error handling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:20 +0200 [PATCH 3.18 08/39] power: supply: bq24190_charger: Call set_mode_host() on pm_resume() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:20 +0200
csiph-web