Input: aiptek - use descriptors of current altsetting
authorJohan Hovold <johan@kernel.org>
Fri, 10 Jan 2020 19:59:52 +0000 (11:59 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 10 Jan 2020 22:42:56 +0000 (14:42 -0800)
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>
Acked-by: Vladis Dronov <vdronov@redhat.com>
Link: https://lore.kernel.org/r/20191210113737.4016-4-johan@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/tablet/aiptek.c

index 06d0ffef4a1714d456467f604288f68b57184941..e08b0ef078e8198474120972a656b09a0150ee09 100644 (file)
@@ -1713,7 +1713,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
 
        aiptek->inputdev = inputdev;
        aiptek->intf = intf;
-       aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber;
+       aiptek->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
        aiptek->inDelay = 0;
        aiptek->endDelay = 0;
        aiptek->previousJitterable = 0;