Commit 5ac24979 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

net: qmi_wwan: simplify a check in qmi_wwan_bind()

This code is easier to read if we specify which flags we want at the
condition instead of at the top of the function.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarBjørn Mork <bjorn@mork.no>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 251da413
...@@ -129,7 +129,6 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) ...@@ -129,7 +129,6 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
struct usb_cdc_union_desc *cdc_union = NULL; struct usb_cdc_union_desc *cdc_union = NULL;
struct usb_cdc_ether_desc *cdc_ether = NULL; struct usb_cdc_ether_desc *cdc_ether = NULL;
u32 required = 1 << USB_CDC_HEADER_TYPE | 1 << USB_CDC_UNION_TYPE;
u32 found = 0; u32 found = 0;
struct usb_driver *driver = driver_of(intf); struct usb_driver *driver = driver_of(intf);
struct qmi_wwan_state *info = (void *)&dev->data; struct qmi_wwan_state *info = (void *)&dev->data;
...@@ -197,7 +196,8 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) ...@@ -197,7 +196,8 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
} }
/* did we find all the required ones? */ /* did we find all the required ones? */
if ((found & required) != required) { if (!(found & (1 << USB_CDC_HEADER_TYPE)) ||
!(found & (1 << USB_CDC_UNION_TYPE))) {
dev_err(&intf->dev, "CDC functional descriptors missing\n"); dev_err(&intf->dev, "CDC functional descriptors missing\n");
goto err; goto err;
} }
......
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