sierra_net: Skip validating irrelevant fields for IDLE LSIs
authorStefan Brüns <stefan.bruens@rwth-aachen.de>
Wed, 8 Feb 2017 01:46:33 +0000 (02:46 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Feb 2017 21:41:43 +0000 (16:41 -0500)
When the context is deactivated, the link_type is set to 0xff, which
triggers a warning message, and results in a wrong link status, as
the LSI is ignored.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/sierra_net.c

index 631b1ed86610a564ecb7162423f8208f6db1bea5..d9440bc022f2c40d965f6a6dd804f7ba74944cbc 100644 (file)
@@ -384,6 +384,13 @@ static int sierra_net_parse_lsi(struct usbnet *dev, char *data, int datalen)
                return -1;
        }
 
+       /* Validate the session state */
+       if (lsi->session_state == SIERRA_NET_SESSION_IDLE) {
+               netdev_err(dev->net, "Session idle, 0x%02x\n",
+                          lsi->session_state);
+               return 0;
+       }
+
        /* Validate the protocol  - only support UMTS for now */
        if (lsi->protocol == SIERRA_NET_PROTOCOL_UMTS) {
                struct lsi_umts_single *single = (struct lsi_umts_single *)lsi;
@@ -417,13 +424,6 @@ static int sierra_net_parse_lsi(struct usbnet *dev, char *data, int datalen)
                return 0;
        }
 
-       /* Validate the session state */
-       if (lsi->session_state == SIERRA_NET_SESSION_IDLE) {
-               netdev_err(dev->net, "Session idle, 0x%02x\n",
-                       lsi->session_state);
-               return 0;
-       }
-
        /* Set link_sense true */
        return 1;
 }