Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5052484ybi; Sat, 20 Jul 2019 11:50:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQAx0CuwUSA5Cp2e4qyUlp26YeX+hZhionIfbyGeAfDt9j1F1U9tpPMu2322CkwZ12NQQ7 X-Received: by 2002:a17:90a:384d:: with SMTP id l13mr66628138pjf.86.1563648602377; Sat, 20 Jul 2019 11:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563648602; cv=none; d=google.com; s=arc-20160816; b=UEmB2ek0HgmX3qPk03EFGQUz0e8ciJnj1mjh5SjcJB4PWqsYKCg9+Re9ENt1H9xMi7 koHpGvTc4PuDcentwawPCNfOckbGAazgtjG2YJg4JGHRXY1d6miFXNldwV2rEg6sYgDP zL156vxKUXyJlNfB6uWVoT1zRSg4n5n/6wu9YyA41UtX223cXltHdIP2dQR6pX4Q+yjH xQd62Sr9aPrdKaiHj2KbwtFfwXi3QHJCcM+ZW1mYZb3JPzlOWG8vC5fprj0caJpR3i3k 7YhVmIakky2BGlKZqwjWoP9amtNdRytwLTB0Wud02q5NgQQZ03NGnir5q+BfuuiBYrEI IseA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:to:from:date:dkim-signature; bh=L2J81KFMB9+2i2dCr/hG5bzUaIW4OMdMzoZ/0Z/JXXY=; b=to3wI3iJYP0I5O/Ib8eEGceqy3ScKuWD4mZlCzxnHYIagM9hfm+G7ni99Qoc71Z9H0 QPzYhL6FbsssB1vcOqqj6T4YJMO6X4o2ViwlFKJ19eEFIr9xIRNqm+jTiDfSToz3ShIB hE8Fj/moYbcnIRxxYY5PQgqAHwmtqHCVYgvmBQt0MLAnz0M44WlAFkFY+CrRv3BjmGUh jFpmeUOCDULkTSzfDmdzZ9waCTQiY2ve8EbOHgE6YcQf9H+tA0EAS2koefcbegCsFOji XfGmZn6rVfGFRJ9yggyts/MvJp0FTUaB9UAHn0+Nr64yrnQGWz5U3gY1eHOtoBp/qz3Y k11g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Km81yo78; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si4236852pjw.89.2019.07.20.11.49.47; Sat, 20 Jul 2019 11:50:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Km81yo78; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726812AbfGTRqz (ORCPT + 99 others); Sat, 20 Jul 2019 13:46:55 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:42195 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbfGTRqy (ORCPT ); Sat, 20 Jul 2019 13:46:54 -0400 Received: by mail-pl1-f193.google.com with SMTP id ay6so17164093plb.9; Sat, 20 Jul 2019 10:46:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=L2J81KFMB9+2i2dCr/hG5bzUaIW4OMdMzoZ/0Z/JXXY=; b=Km81yo78w+rlAwT/gwFYfbv28Jgs5BCE1MgsQFEdhlhCgQmjldFaKcy3u0HTBYiloX L8XYW/LnaW6ORsZjO8+44qrXVhFzdUCUkEV8eURKJ+SkqB0At6u+qSYVIBIwiXjpTM/x 7gmIG7cv4tJFKGtaNpt1pbUjJsWKyfSX04XSoIMkikNZ7T4JXBDCPK5lP7tR6KgYGew9 X2ynm2oIHwy3DHRFm78hJguuTFf+gae7qCd2Iwx4GwZQb3lVfmvgExXMNB9Qz8KkCBgW /aqS1YpNQwnrsMTPeWPnYC+ymVRJtmHwMME+8W+cIYYvsvRg4aiq+MCJa1SC2V0Ng/By V0ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=L2J81KFMB9+2i2dCr/hG5bzUaIW4OMdMzoZ/0Z/JXXY=; b=otzGIJpzqIu0XDfNr0siqTNPXlKSN1j9qofRdRDoAKVjxosqKqXFJ+Ni9uMVqG7H/x SU3JP9tf5CKBI/ttjN/hBpmBFgSk5G9jYsfCc0lzMsOsJg7Lf9O+ByTGaWf9P6f3MEhf NA7HpfTNViy4SBzxJp+9a6qHpjo64gnxFc8p4Ns1bOtll8UVA6pmJgNQwBA1kopzWQxu DTZZhmoptwOHMFQLkee+GC5hUWZnq09o3YG1Imrt6CgLnSiSVBJGbC62G/NVnjzISRUs prgmibjWu8q7vyM4+ck3rMxbfkab2YAM91+u6I6Eo38m/SvhX+M9XpzsFLGPj4VdQ68P aRaQ== X-Gm-Message-State: APjAAAURb5M1oEYKTNxDvzMVsJMbERywJGx0lWByVisXNN1ciqiYNQQh N/JU3y71qFQsTkSjfr11A5A= X-Received: by 2002:a17:902:1e6:: with SMTP id b93mr63580645plb.295.1563644814133; Sat, 20 Jul 2019 10:46:54 -0700 (PDT) Received: from hari-Inspiron-1545 ([183.83.86.126]) by smtp.gmail.com with ESMTPSA id q69sm49590614pjb.0.2019.07.20.10.46.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Jul 2019 10:46:53 -0700 (PDT) Date: Sat, 20 Jul 2019 23:16:47 +0530 From: Hariprasad Kelam To: Kalle Valo , "David S. Miller" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rat_cs: Remove duplicate code Message-ID: <20190720174613.GA31062@hari-Inspiron-1545> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Code is same if translate is true/false in case invalid packet is received.So remove else part. Issue identified with coccicheck Signed-off-by: Hariprasad Kelam --- drivers/net/wireless/ray_cs.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index cf37268..a51bbe7 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -2108,29 +2108,16 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, #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; + 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; } - } } pr_debug("ray_cs rx_data packet\n"); /* If fragmented packet, verify sizes of fragments add up */ -- 2.7.4