Commit 3de50478 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

media: flexcop-usb: clean up endpoint sanity checks

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: default avatarJohan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20220822151456.27178-2-johan@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 67102bd3
...@@ -501,17 +501,21 @@ static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb) ...@@ -501,17 +501,21 @@ static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb)
static int flexcop_usb_init(struct flexcop_usb *fc_usb) static int flexcop_usb_init(struct flexcop_usb *fc_usb)
{ {
/* use the alternate setting with the larges buffer */ struct usb_host_interface *alt;
int ret = usb_set_interface(fc_usb->udev, 0, 1); int ret;
/* use the alternate setting with the largest buffer */
ret = usb_set_interface(fc_usb->udev, 0, 1);
if (ret) { if (ret) {
err("set interface failed."); err("set interface failed.");
return ret; return ret;
} }
if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1) alt = fc_usb->uintf->cur_altsetting;
if (alt->desc.bNumEndpoints < 1)
return -ENODEV; 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; return -ENODEV;
switch (fc_usb->udev->speed) { switch (fc_usb->udev->speed) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment