From patchwork Wed Jun 28 02:16:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You Kangren X-Patchwork-Id: 13295178 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25D3BEB64D9 for ; Wed, 28 Jun 2023 02:17:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231206AbjF1CRF (ORCPT ); Tue, 27 Jun 2023 22:17:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231187AbjF1CRC (ORCPT ); Tue, 27 Jun 2023 22:17:02 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2128.outbound.protection.outlook.com [40.107.255.128]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B45E2D72; Tue, 27 Jun 2023 19:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VikRCQtFH6f5IabNmX3+/cIrZhlLal2b9e74qwTf6yndPsfwVZV+oBygsMdB+IUYzlwEQ1BY4OZixaGHtKeXLbrcAsxtZahA07Uhv/tthZbvw6OQctzAfBCwLhVoa6oQNRk+Pq6fcqrayfNgRGNSx6QOj98xYcR/s9nbTfGBT1S1XRqBfNUS2d3M86tf/H3Z61XxkplAq5dCqEv4Xd4FnyoW7uCEuT5JYKu8ExV2fanARcXY8k80uVlyNxXGzaflhPSoT782anTChHexVts/9+aLJWfR+HV+Co2a7cu97nBPbpPmY1oja0X16E3m85jQUJvPCoUJgUHEI5bh5m/xLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/yZRszPr7szpVTdmejxYi7RIvr8oXSpWiSD9Bh/eWq8=; b=lKD+GAni5Xdq7Ukx3ui8iu70X542sGhz9k5FaRnd6aMIDvz5sHx2qvFJq3W2a9yTNDVT3pIUEnlquScRfzOb1kWCiWxXQU73z4tjjpITurqGLLwpWiJpcZX6+qhU7eqp3ILppCxJE5MLrvIAWN7J+oR0WAQ5gmVtQIuowfEwSdiFqwToFothVlVadRpyOOdg/FhRHrDEt9XUf2uzK0HBfYO+5gG8gvMT6YKIH4M3sQmKDhGaTNXZCBTr3jIkjg1D3+qDoKSIA+9kk3ZRSTpR2AudnLWxD2MgurVE3sqNYt27QLPufih0p2HObXd83uIFU/Szinnj03D2zlgQwsBsUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/yZRszPr7szpVTdmejxYi7RIvr8oXSpWiSD9Bh/eWq8=; b=KKIozlLVpD/n350xOfFhi/KW4Mw3f00gEmqjfyJKynAgdWeLNnXziJ/g1ucMUHmFsR/mtPzbtx9t0i66gRaxYIPanq8MYW2ysxQwbdnuIlt0I2iho9s6QLgzvOp2+rCXEJb04Z1sReAol4hyIJnTr1YZBls3CdyGgyU8ua6mNY6P/1/Icj6W0r3s7JBFpcrmnmq/pvsrAcbkoDWyDDKS85Uw1TBaswwWOLLU4w2O02tuG7WMFDU1MzxTAayjp1hnVg/gD2rU6SG5e0HV52YUuIM0uPtccNv4kFGYCrCokVo6wJlmAqQMv7MbGc16xCn5GhJh7naQ0E1SIrozrO14jg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PUZPR06MB5936.apcprd06.prod.outlook.com (2603:1096:301:11d::13) by SEYPR06MB6131.apcprd06.prod.outlook.com (2603:1096:101:dc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 02:16:55 +0000 Received: from PUZPR06MB5936.apcprd06.prod.outlook.com ([fe80::adc0:c22:ffae:227b]) by PUZPR06MB5936.apcprd06.prod.outlook.com ([fe80::adc0:c22:ffae:227b%6]) with mapi id 15.20.6500.045; Wed, 28 Jun 2023 02:16:55 +0000 From: You Kangren To: Kalle Valo , Dongliang Mu , Christophe JAILLET , You Kangren , Simon Horman , linux-wireless@vger.kernel.org (open list:RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER), linux-kernel@vger.kernel.org (open list) Cc: opensource.kernel@vivo.com Subject: [PATCH v3] Remove unnecessary conditional statements Date: Wed, 28 Jun 2023 10:16:46 +0800 Message-Id: <20230628021647.28655-1-youkangren@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: TY2PR01CA0019.jpnprd01.prod.outlook.com (2603:1096:404:a::31) To PUZPR06MB5936.apcprd06.prod.outlook.com (2603:1096:301:11d::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5936:EE_|SEYPR06MB6131:EE_ X-MS-Office365-Filtering-Correlation-Id: c30dc363-7e8c-4e70-5be9-08db777dbe02 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZxTTs1rfpc3fBB1VXMN5RbG9pGd4UpsuXZp800duke99c0FBWmQlTQJqtWFb6I9XM2o1+ZiuGUjiPlVAI1bM5Z8rYdANaQqyU7SJcU81VmJw7E+wP/ktsfILxujE+nAywlbSBQV30EouoP2J+HmuhSW+UuswsBXOOKaPhJfpkv3OAYWV+NB0Rx+9zYu+IpYBfGhUtIVbHsb4VYFXAIMJdHgsaOCXiLYiLdyPIGul4jgZ1BX+IUXJC61NCbXElOL08iCEd0zU3DQEOvhwHU/+buUWGMIQjonj3EPM/6vSIN1gQgQgD116RYBMuQ1HFLysX9JR3LXuat/vXaIGwj7hKo7MX99/qomWTHZaCF/DuhF/Lui5xbszDqK7S8Ub3xe2BxumAc8mQBt7yTwIGsEzoQ45HacbOpP4KWEC9e1pNcQYTGpoqvDoWjBuC1crToOOQrKLAF89W0DO/4/2UhRNB+H16Btc/AJjcqJW/IoxEFS15aDhRFh1J7f+UBfGwrj7CsaMAcpBE86aohbhMwq+MbWnUqy9XKS2XnyAL8/aWA3lakg8c1TlGgMczpJE93YFRFXw8mFXqyl317ZwMPptXY683bcb3+02B9aPeKcJqfqcmr9rHBIQ2CmRPrXrQBbo X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5936.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(136003)(376002)(39860400002)(396003)(346002)(451199021)(2906002)(186003)(38350700002)(52116002)(6486002)(107886003)(38100700002)(83380400001)(2616005)(6506007)(6512007)(6666004)(26005)(86362001)(1076003)(110136005)(41300700001)(478600001)(316002)(36756003)(4326008)(66946007)(66556008)(66476007)(5660300002)(8676002)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WT+8IAPBgAhDQXMj7rxGnlmwgs9+2+u+e4ntDEeEjMbjR+ilsd7v1h8wh3VCTVb3Bagthk8btLzBCQV0702iIT136sPDPW6rn9P9xX/V+4ZJ7goUB6sV1J8IcQAdUB774FVkYMCY6ZdKGfFgzyKorgP5P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5u/fHR+YA6SCwa1sxpLu1b8oieNkluN3os9JZBdTQecnItjHRmiGyvht6U7eu8avwjrDkdhFH3nokxgT/tmoHET77e7p9oOUdrDrO2mLNRXg+FsqOSw//hJ+BJSNhbXEpM5pikvP2cyKdlQ58Qa4FoDNUpEhii600dX8WB2VF90d1gC0+HoDSlP/nOi9HYzIg+5zW2SyFVRsAmdXRwtf4nA3RE2crXXXxenFcqNnC3RgzAPi5qU34EqtDiekq+Wmsfjnb6LLms9AKJ/Q0CGJN5/YWJmGmSVRrmlRmxphKE8O/CqNCfxGOugwz4O5wnOkojmG8E2aE7S1GJg1Ljhb002JsCDFR2ZktzIz9kkArQ+ykN4 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c30dc363-7e8c-4e70-5be9-08db777dbe02 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5936.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 02:16:54.7922 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OdujKAM9jRdO9Z3HUw+JR+IAz81JMrjnEfgO14vDAzDbZHCd7uSeTArfiwuMGMXqY6+GetyVQ84675d2RSSxkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6131 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org A warning is found at compiling time that the if and else branches in the rx_data function have no effect, we check the code and find the contents of both branches are the same, so we merge the contents of both branches into one. Signed-off-by: You Kangren --- drivers/net/wireless/legacy/ray_cs.c | 30 ++++++---------------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c index 8ace797ce951..dc2feb88453e 100644 --- a/drivers/net/wireless/legacy/ray_cs.c +++ b/drivers/net/wireless/legacy/ray_cs.c @@ -2116,30 +2116,12 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, u_char linksrcaddr[ETH_ALEN]; /* Other end of the wireless link */ #endif - if (!sniffer) { - if (translate) { -/* TBD length needs fixing for translated header */ - if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) || - rx_len > - (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + - FCS_LEN)) { - pr_debug( - "ray_cs invalid packet length %d received\n", - rx_len); - return; - } - } else { /* encapsulated ethernet */ - - if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) || - rx_len > - (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + - FCS_LEN)) { - pr_debug( - "ray_cs invalid packet length %d received\n", - rx_len); - return; - } - } + /* TBD length needs fixing for translated header */ + if (!sniffer && (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) || + rx_len > (dev->mtu + RX_MAC_HEADER_LENGTH + + ETH_HLEN + FCS_LEN))) { + pr_debug("ray_cs invalid packet length %d received\n", rx_len); + return; } pr_debug("ray_cs rx_data packet\n"); /* If fragmented packet, verify sizes of fragments add up */