]> git.baikalelectronics.ru Git - kernel.git/commitdiff
can: gs_usb: gs_usb_probe(): use descriptors of current altsetting
authorJohan Hovold <johan@kernel.org>
Tue, 10 Dec 2019 11:32:31 +0000 (12:32 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 2 Jan 2020 14:34:27 +0000 (15:34 +0100)
Make sure to always use the descriptors of the current alternate setting
to avoid future issues when accessing fields that may differ between
settings.

Signed-off-by: Johan Hovold <johan@kernel.org>
Fixes: ff8e02f02963 ("can: gs_usb: Added support for the GS_USB CAN devices")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/gs_usb.c

index 2f74f6704c1286dc678c323aceaa34f0c64396ab..a4b4b742c80c322a5759fdb7b62c4f57368462ac 100644 (file)
@@ -918,7 +918,7 @@ static int gs_usb_probe(struct usb_interface *intf,
                             GS_USB_BREQ_HOST_FORMAT,
                             USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
                             1,
-                            intf->altsetting[0].desc.bInterfaceNumber,
+                            intf->cur_altsetting->desc.bInterfaceNumber,
                             hconf,
                             sizeof(*hconf),
                             1000);
@@ -941,7 +941,7 @@ static int gs_usb_probe(struct usb_interface *intf,
                             GS_USB_BREQ_DEVICE_CONFIG,
                             USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
                             1,
-                            intf->altsetting[0].desc.bInterfaceNumber,
+                            intf->cur_altsetting->desc.bInterfaceNumber,
                             dconf,
                             sizeof(*dconf),
                             1000);