]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: flexcop-usb: clean up endpoint sanity checks
authorJohan Hovold <johan@kernel.org>
Mon, 22 Aug 2022 15:14:54 +0000 (17:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:32:23 +0000 (13:32 +0200)
[ Upstream commit 3de50478b5cc2e0c2479a5f2b967f331f7597d23 ]

Add a temporary variable to make the endpoint sanity checks a bit more
readable.

While at it, fix a typo in the usb_set_interface() comment.

Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20220822151456.27178-2-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: f62dc8f6bf82 ("media: flexcop-usb: fix sanity check of bNumEndpoints")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/b2c2/flexcop-usb.c

index 2299d5cca8ffb6d418b88c2e6bfdc366dc3c31ef..6d199b32e31708076f3d553ecd64fd46aa4d42f8 100644 (file)
@@ -502,17 +502,21 @@ urb_error:
 
 static int flexcop_usb_init(struct flexcop_usb *fc_usb)
 {
-       /* use the alternate setting with the larges buffer */
-       int ret = usb_set_interface(fc_usb->udev, 0, 1);
+       struct usb_host_interface *alt;
+       int ret;
 
+       /* use the alternate setting with the largest buffer */
+       ret = usb_set_interface(fc_usb->udev, 0, 1);
        if (ret) {
                err("set interface failed.");
                return ret;
        }
 
-       if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1)
+       alt = fc_usb->uintf->cur_altsetting;
+
+       if (alt->desc.bNumEndpoints < 1)
                return -ENODEV;
-       if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[0].desc))
+       if (!usb_endpoint_is_isoc_in(&alt->endpoint[0].desc))
                return -ENODEV;
 
        switch (fc_usb->udev->speed) {