Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1001003iob; Thu, 12 May 2022 09:02:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9+zz8fHOjnSgYAIUoFuzRmo7q+DI7MuLa17RmeZzay2UoCDqjaXGiyrxDEN9CiJF5enmd X-Received: by 2002:a05:6402:5108:b0:427:e323:4c67 with SMTP id m8-20020a056402510800b00427e3234c67mr36432685edd.326.1652371377937; Thu, 12 May 2022 09:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652371377; cv=none; d=google.com; s=arc-20160816; b=OSDhj1r9kBuyjx8qopNMUjC7MiFpfG2aRIHIp71Fdux9nd6IAu+0IpoJ5V59FyMRl3 +aRXtXepzKCb50NAnn7rzM8yJh416ic9uc7joT2D7lYD+BE1i4kQwP99fyblG9sC6gOo q0GJFVLmx0sGdGL9HBFPfs30eRx5Td96BNot+zxXIORtQN+Ih+oUDnlClwqkjVlKo5Z6 L0h0dxLjgmp1b2RZbQQzDiIl2FJlimASqew+efPFCWiqdHHXHm4mKqytmDlaEEncI7YY dlnmta4z1Ok8fDPFj00BL+pSYlEQHpgmjh2vuX+KnYtPL6JclI0cDDlUd9XXioG5mZH1 L1Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=GMskZKeYJ+qZQlS0wrRsdtxzoSoOQv+/vGAWNJBilr8=; b=mMTuCyGcq+l/2H4Tk6dhD2CABlYECRc5D14i7K0QmbuieYqL13gc056GlySOhsclgs ttP6zb+cNWhIw+7FUlzTAVN30H7ad5A2gyzqb9IhyiWlF1uhxV3VDadzkDNtUGoKUP74 Yxzkyh2I7WBQFaIjxCayCvwik1U4IK/Rsl96hDqAbK6NRKL2EFXdkNVpWZ7HYIbWezfr nYQIZ2N5eo/c+DqyqjeTFxGXB+26YjENYXXZKEt/rHQkqAHd+RVNQMFtPqkmPF+t4HQu htyIZvtDNHcBV1sEPTFwpO+hzxtertyD/4EkYYGdrayOutca2rVpCfhYITUDgy8W7SCN pddw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw22-20020a170906479600b006f4408c9ea4si7694964ejc.540.2022.05.12.09.02.28; Thu, 12 May 2022 09:02:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344263AbiELDYz (ORCPT + 99 others); Wed, 11 May 2022 23:24:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238977AbiELDYx (ORCPT ); Wed, 11 May 2022 23:24:53 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 945BF5D67C; Wed, 11 May 2022 20:24:51 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R431e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0VCykjJ9_1652325870; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VCykjJ9_1652325870) by smtp.aliyun-inc.com(127.0.0.1); Thu, 12 May 2022 11:24:49 +0800 From: Jiapeng Chong To: wellslutw@gmail.com Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, p.zabel@pengutronix.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] net: ethernet: Use swap() instead of open coding it Date: Thu, 12 May 2022 11:24:29 +0800 Message-Id: <20220512032429.94306-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clean the following coccicheck warning: ./drivers/net/ethernet/sunplus/spl2sw_driver.c:217:27-28: WARNING opportunity for swap(). ./drivers/net/ethernet/sunplus/spl2sw_driver.c:222:27-28: WARNING opportunity for swap(). Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- drivers/net/ethernet/sunplus/spl2sw_driver.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c index 8320fa833d3e..cccf14325ba8 100644 --- a/drivers/net/ethernet/sunplus/spl2sw_driver.c +++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c @@ -204,8 +204,6 @@ static const struct net_device_ops netdev_ops = { static void spl2sw_check_mac_vendor_id_and_convert(u8 *mac_addr) { - u8 tmp; - /* Byte order of MAC address of some samples are reversed. * Check vendor id and convert byte order if it is wrong. * OUI of Sunplus: fc:4b:bc @@ -213,19 +211,13 @@ static void spl2sw_check_mac_vendor_id_and_convert(u8 *mac_addr) if (mac_addr[5] == 0xfc && mac_addr[4] == 0x4b && mac_addr[3] == 0xbc && (mac_addr[0] != 0xfc || mac_addr[1] != 0x4b || mac_addr[2] != 0xbc)) { /* Swap mac_addr[0] and mac_addr[5] */ - tmp = mac_addr[0]; - mac_addr[0] = mac_addr[5]; - mac_addr[5] = tmp; + swap(mac_addr[0], mac_addr[5]); /* Swap mac_addr[1] and mac_addr[4] */ - tmp = mac_addr[1]; - mac_addr[1] = mac_addr[4]; - mac_addr[4] = tmp; + swap(mac_addr[1], mac_addr[4]); /* Swap mac_addr[2] and mac_addr[3] */ - tmp = mac_addr[2]; - mac_addr[2] = mac_addr[3]; - mac_addr[3] = tmp; + swap(mac_addr[2], mac_addr[3]); } } -- 2.20.1.7.g153144c