From patchwork Tue Jun 27 02:42:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You Kangren X-Patchwork-Id: 697194 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 EBC58EB64D7 for ; Tue, 27 Jun 2023 02:42:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229724AbjF0Cm1 (ORCPT ); Mon, 26 Jun 2023 22:42:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbjF0Cm0 (ORCPT ); Mon, 26 Jun 2023 22:42:26 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2128.outbound.protection.outlook.com [40.107.117.128]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88414173A; Mon, 26 Jun 2023 19:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=db0zS1AImQftSn+Z6rAs0mnBkKcNAkxLcwAoS2ZAltXP0wgdccfkT8gvjvlhjr7IT9mVPdsbvSuvOOdmXdOoNyRg1wh6hpugFwEoD0F7JGqPgSm/aLQZ0NHuULXl8uGysi0FksB7Xjd8Gxuwt2ahO5Xd+esaAiJHjk/x/RMF6QQNL2HZ4uXh3osvgbkFqlV2elmYqIlyMZYHRtnzDAQHuo80QQaHrkRCj+0cTIusXpFgJJDkf9QxQwmNvmWEeK4UUNLQYlUdSpcl9AFZ2vtsuPYss3by2OdGQm6vGYQsYhocG1K5g4yS+c75XUlRyEcrz4hUJeY6W/kZ6o2dwP5FEA== 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=UOGB5c45cFt4pHBDtBGsipeS7s7UAioafrQLcGXqeZM=; b=lKKTJMvfhMPh4bcrzgKbVKLhiu1lN3YLacNLO1jiEeLGIqtHKDIerQGmO7I9eXG2N5nCR3xoBMX4icxYlXyeN6vu2VLS5QqXXhefB03jE3hnCuhGjc3JMMTVtbynLtU642etYuk8ngX+gZK76okd8EJRNt/nQNqsOYNi819ow8AUiILsa+qUzvGGUMf5i6bkXrX7ARcGT/cDi7QeJsf4Wf5B/YHk2mSuT8MYHp+pKUvwwlIz3NT4ieJ52htwdK0sKios+mXhUF0Y9CmyiUK5UJ03FuyYaK6y3YuWWIFpglU9UpHCmvsBqnosvfJQnSOFeVbN0W2I8S3l11vkr45QSQ== 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=UOGB5c45cFt4pHBDtBGsipeS7s7UAioafrQLcGXqeZM=; b=EMAnyei5KJofEeQpSNpxNbKyNVhXGb4xSa+iLaAeJGtiuZs8TsTixKDenqybQkeqLTqr6hbF2N1ObxMsyj9LtU5JYY7uKPzEC0FJTgNeVQ7PHEUA873zBC3aJmyx5xFKzZHi646YizbRodADaJIBFBK/IBmg8r/H0UKP3Fakv/d0ftYmluFutoqweWdMIr7oq49aAx48WNI1FQHTX/SbklOEppTHtrP3poNP4VaqNBu7WvRY1YoyOFFiKkOZdvM5co2fXWA0LFLifYKEGxzxLDc9/XljaOlJAJhKrPCzXgUhNYEjGbOt3qpp5XAv98PurQUNOx6+R2IJoHRw+Msipg== 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 TYSPR06MB6528.apcprd06.prod.outlook.com (2603:1096:400:47a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Tue, 27 Jun 2023 02:42:20 +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; Tue, 27 Jun 2023 02:42:19 +0000 From: You Kangren To: Kalle Valo , You Kangren , Dongliang Mu , Christophe JAILLET , 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 v2] wifi: ray_cs: Remove unnecessary conditional statements Date: Tue, 27 Jun 2023 10:42:07 +0800 Message-Id: <20230627024211.18385-1-youkangren@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: SG2PR02CA0101.apcprd02.prod.outlook.com (2603:1096:4:92::17) To PUZPR06MB5936.apcprd06.prod.outlook.com (2603:1096:301:11d::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5936:EE_|TYSPR06MB6528:EE_ X-MS-Office365-Filtering-Correlation-Id: e251c4ef-4e35-47aa-1b26-08db76b82065 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cDSMzT3DBusG24E/CelomkNwRb5hjHiuQP4zoMr1oZ1EvIqBVZZKvlt6bFlI1qcmJIRk4VNHSp4/7aufwLQNVQY67QcA4/sffVThOeKrQOwkZSF7l78Yee1NaFZn12N+oHUTQ46zbbbIC3Zu/cmaBDKuAk7CqSlMR86kO2eIIUcSUQHwXRKpfin2nBEUP0i5X07cCD6Ex47eBOqJcOMfQcd0LKblxdnja0q2BTUiXBfyuqTf/M9dIT2u2CREEWI7rMoaOzkWeCqJR8IDiS9O/pa6H29699qECKS6i3GkUh+FLlik8HqHKGOn5rUFqlg8bXIHFiQ38gElDeWvgp3rP2CPit08vOYQIrWkkYhJQ8IporC8PgITud4F1122cb7s5vNKG1rQtPODmTTst7jmnKBfZ4pgqT5qtRFvrtGLnEgMxGTbGnzkWw8fchMAXasMGWvpJlqAbUADGbtE2JliXTKMZ6XXpSScxcMS4EwM+1vpBefvB4HN40MukfAJafpHPEpyoCD8xIBsV4gIwjsVRQp32e8tAo6p0ywospGJBiOH0tHXIF0g08imXtiVaGY5WB8jqW3vWazc2sBtcefQRD5AqIYH30EIxMV+30PofmWWhLAj6nDll3x7kA829b5s 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)(136003)(396003)(39860400002)(376002)(366004)(346002)(451199021)(5660300002)(66946007)(66556008)(4326008)(66476007)(478600001)(36756003)(316002)(8676002)(8936002)(2906002)(110136005)(86362001)(41300700001)(6486002)(52116002)(186003)(38350700002)(6512007)(26005)(6506007)(1076003)(2616005)(38100700002)(107886003)(6666004)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vrd3RBjginTj5+HuR1ZRZ32vLAP3ZYxcE8y6Cf9PRbOa1jlU7yyV+gcVGqh5eGADeQ31OnE2oTbdzxM36XAl4d45HDIK4ULFH7aAXnXXBYne5gBf+wumpV5gfchOx97aHjcvXiu+1YWfMFN7s44WiRrNMA3/wx4eIcX3+VO9+ge8t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zBKviR2Ar1/dkCo/AR80KPLcv/sBlry1zNMXGF3EhsTFdw5gPHaNp2fkoWhZhFJhR+hD8x97wRqCZAhvI7NJoQhE9Wt6ulyehKegoVmqXkiyhTzxij3zAFH7o1ai4Bott8PVTJe/iUFYbRrgKmVAR5l8zwpG0xMiFvlbDwVa1dQ3Yw91THbR6Bpeb1YxJXCjH0gGGJGERwQxrJPk+fNaSNdzDbkRlvYOTK5565SOpohOgiCpxOf0gl6St7KVMqyp34VDuJYvcrrUCv+s4UXF8l9Zo0DrZmf8AcjBC1KoDa2uhzgtkPMYPk7rBBujVio8mWP0IimYjzRSbZwpcH2NVEoTuqEYBskz2AUpbQr7Nk462gD X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e251c4ef-4e35-47aa-1b26-08db76b82065 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5936.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2023 02:42:19.4572 (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: lQh2trPDZukMiH/T9SSBY3crT9rnWWbZoRsT/LgO07hkNGXMAi+ZsKAEEYc6Nu1/ZtLH43nPX/i0OHxu+Bn9JA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR06MB6528 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Remove unnecessary conditional statements to simplify the code Signed-off-by: You Kangren Reviewed-by: Simon Horman --- 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 5f97fcf5c4ba..e4ea22316a03 100644 --- a/drivers/net/wireless/legacy/ray_cs.c +++ b/drivers/net/wireless/legacy/ray_cs.c @@ -2115,30 +2115,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 */