All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 4.4] net: cdc_ncm: initialize drvflags before usage
@ 2018-02-06 19:59 Matthias
  2018-02-06 20:34 ` Patch "net: cdc_ncm: initialize drvflags before usage" has been added to the 4.4-stable tree gregkh
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias @ 2018-02-06 19:59 UTC (permalink / raw)
  To: stable; +Cc: mrkiko.rs

From: Matthias Hintzmann <matthias.dev@gmx.de>

ctx->drvflags is checked in the if clause before beeing initialized. 
Move initialization before first usage.

Note, that the if clause was backported with commit 75f82a703b30 
("cdc_ncm: Set NTB format again after altsetting switch for Huawei 
devices") from mainline (upstream commit 2b02c20ce0c2 ("cdc_ncm: Set 
NTB format again after altsetting switch for Huawei devices"). 
In mainline, the initialization is at the right place before the if 
clause.

Fixes: 75f82a703b30 ("cdc_ncm: Set NTB format again after altsetting switch for Huawei devices")
Signed-off-by: Matthias Hintzmann <matthias.dev@gmx.de>
[mrkiko.rs@gmail.com: commit message tweaks]
---
 drivers/net/usb/cdc_ncm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 1228d0da407..72cb30828a1 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -825,6 +825,9 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
 		goto error2;
 	}
 
+	/* Device-specific flags */
+	ctx->drvflags = drvflags;
+
 	/*
 	 * Some Huawei devices have been observed to come out of reset in NDP32 mode.
 	 * Let's check if this is the case, and set the device to NDP16 mode again if
@@ -873,9 +876,6 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
 	/* finish setting up the device specific data */
 	cdc_ncm_setup(dev);
 
-	/* Device-specific flags */
-	ctx->drvflags = drvflags;
-
 	/* Allocate the delayed NDP if needed. */
 	if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) {
 		ctx->delayed_ndp16 = kzalloc(ctx->max_ndp_size, GFP_KERNEL);
-- 
2.15.1

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

end of thread, other threads:[~2018-02-06 20:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-06 19:59 [PATCH v2 4.4] net: cdc_ncm: initialize drvflags before usage Matthias
2018-02-06 20:34 ` Patch "net: cdc_ncm: initialize drvflags before usage" has been added to the 4.4-stable tree gregkh

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.