All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] net: qmi_wwan: simplify a check in qmi_wwan_bind()
@ 2012-06-26  8:39 Dan Carpenter
  2012-06-27  0:13 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-06-26  8:39 UTC (permalink / raw)
  To: netdev; +Cc: Bjørn Mork, David S. Miller

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: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Bjørn Mork <bjorn@mork.no>

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index f1e7791..23cb13c 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -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_cdc_union_desc *cdc_union = NULL;
 	struct usb_cdc_ether_desc *cdc_ether = NULL;
-	u32 required = 1 << USB_CDC_HEADER_TYPE | 1 << USB_CDC_UNION_TYPE;
 	u32 found = 0;
 	struct usb_driver *driver = driver_of(intf);
 	struct qmi_wwan_state *info = (void *)&dev->data;
@@ -197,7 +196,8 @@ next_desc:
 	}
 
 	/* 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");
 		goto err;
 	}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] net: qmi_wwan: simplify a check in qmi_wwan_bind()
  2012-06-26  8:39 [patch] net: qmi_wwan: simplify a check in qmi_wwan_bind() Dan Carpenter
@ 2012-06-27  0:13 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-06-27  0:13 UTC (permalink / raw)
  To: dan.carpenter; +Cc: netdev, bjorn

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 26 Jun 2012 11:39:45 +0300

> 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: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Bjørn Mork <bjorn@mork.no>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-27  0:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-26  8:39 [patch] net: qmi_wwan: simplify a check in qmi_wwan_bind() Dan Carpenter
2012-06-27  0:13 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.