Staging: bcm: Qos.c: Replaced do-while(0) jumps with goto and label, removes one...
authorMatthias Beyer <mail@beyermatthias.de>
Tue, 29 Jul 2014 14:52:15 +0000 (16:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Jul 2014 00:14:22 +0000 (17:14 -0700)
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/bcm/Qos.c

index 817d1151aaf3a7b03a060a8cad38d10a0cd22b19..c4a75a8343fa1c32451034d9f383d167f665d17d 100644 (file)
@@ -219,67 +219,66 @@ static USHORT     IpVersion4(struct bcm_mini_adapter *Adapter,
 
        xprt_hdr = (struct bcm_transport_header *)((PUCHAR)iphd + sizeof(struct iphdr));
 
-       do {
-               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Trying to see Direction = %d %d",
-                       pstClassifierRule->ucDirection,
-                       pstClassifierRule->usVCID_Value);
-
-               /* Checking classifier validity */
-               if (!pstClassifierRule->bUsed || pstClassifierRule->ucDirection == DOWNLINK_DIR)
-                       break;
-
-               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "is IPv6 check!");
-               if (pstClassifierRule->bIpv6Protocol)
-                       break;
-
-               /* Checking IP header parameter */
-               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Trying to match Source IP Address");
-               if (!MatchSrcIpAddress(pstClassifierRule, iphd->saddr))
-                       break;
-               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Source IP Address Matched");
-
-               if (!MatchDestIpAddress(pstClassifierRule, iphd->daddr))
-                       break;
-               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Destination IP Address Matched");
-
-               if (!MatchTos(pstClassifierRule, iphd->tos)) {
-                       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "TOS Match failed\n");
-                       break;
-               }
-               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "TOS Matched");
-
-               if (!MatchProtocol(pstClassifierRule, iphd->protocol))
-                       break;
-               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Protocol Matched");
+       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Trying to see Direction = %d %d",
+               pstClassifierRule->ucDirection,
+               pstClassifierRule->usVCID_Value);
+
+       /* Checking classifier validity */
+       if (!pstClassifierRule->bUsed || pstClassifierRule->ucDirection == DOWNLINK_DIR)
+               goto out;
+
+       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "is IPv6 check!");
+       if (pstClassifierRule->bIpv6Protocol)
+               goto out;
+
+       /* Checking IP header parameter */
+       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Trying to match Source IP Address");
+       if (!MatchSrcIpAddress(pstClassifierRule, iphd->saddr))
+               goto out;
+       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Source IP Address Matched");
+
+       if (!MatchDestIpAddress(pstClassifierRule, iphd->daddr))
+               goto out;
+       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Destination IP Address Matched");
+
+       if (!MatchTos(pstClassifierRule, iphd->tos)) {
+               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "TOS Match failed\n");
+               goto out;
+       }
+       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "TOS Matched");
 
-               /*
-                * if protocol is not TCP or UDP then no
-                * need of comparing source port and destination port
-                */
-               if (iphd->protocol != TCP && iphd->protocol != UDP) {
-                       bClassificationSucceed = TRUE;
-                       break;
-               }
-               /* Checking Transport Layer Header field if present */
-               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Source Port %04x",
-                       (iphd->protocol == UDP) ? xprt_hdr->uhdr.source : xprt_hdr->thdr.source);
+       if (!MatchProtocol(pstClassifierRule, iphd->protocol))
+               goto out;
+       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Protocol Matched");
 
-               if (!MatchSrcPort(pstClassifierRule,
-                                 ntohs((iphd->protocol == UDP) ?
-                                 xprt_hdr->uhdr.source : xprt_hdr->thdr.source)))
-                       break;
-               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Src Port Matched");
-
-               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Destination Port %04x",
-                       (iphd->protocol == UDP) ? xprt_hdr->uhdr.dest :
-                       xprt_hdr->thdr.dest);
-               if (!MatchDestPort(pstClassifierRule,
-                                  ntohs((iphd->protocol == UDP) ?
-                                  xprt_hdr->uhdr.dest : xprt_hdr->thdr.dest)))
-                       break;
+       /*
+        * if protocol is not TCP or UDP then no
+        * need of comparing source port and destination port
+        */
+       if (iphd->protocol != TCP && iphd->protocol != UDP) {
                bClassificationSucceed = TRUE;
-       } while (0);
-
+               goto out;
+       }
+       /* Checking Transport Layer Header field if present */
+       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Source Port %04x",
+               (iphd->protocol == UDP) ? xprt_hdr->uhdr.source : xprt_hdr->thdr.source);
+
+       if (!MatchSrcPort(pstClassifierRule,
+                         ntohs((iphd->protocol == UDP) ?
+                         xprt_hdr->uhdr.source : xprt_hdr->thdr.source)))
+               goto out;
+       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Src Port Matched");
+
+       BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Destination Port %04x",
+               (iphd->protocol == UDP) ? xprt_hdr->uhdr.dest :
+               xprt_hdr->thdr.dest);
+       if (!MatchDestPort(pstClassifierRule,
+                          ntohs((iphd->protocol == UDP) ?
+                          xprt_hdr->uhdr.dest : xprt_hdr->thdr.dest)))
+               goto out;
+       bClassificationSucceed = TRUE;
+
+out:
        if (TRUE == bClassificationSucceed) {
                INT iMatchedSFQueueIndex = 0;