From: Matthias Beyer Date: Tue, 29 Jul 2014 14:52:15 +0000 (+0200) Subject: Staging: bcm: Qos.c: Replaced do-while(0) jumps with goto and label, removes one... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6ff4d01016bae45e635c5e646aa6a619ba320ab9;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Staging: bcm: Qos.c: Replaced do-while(0) jumps with goto and label, removes one level of indentation Signed-off-by: Matthias Beyer Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/bcm/Qos.c b/drivers/staging/bcm/Qos.c index 817d1151aaf3..c4a75a8343fa 100644 --- a/drivers/staging/bcm/Qos.c +++ b/drivers/staging/bcm/Qos.c @@ -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;