Received: by 2002:a05:6512:3d0e:0:0:0:0 with SMTP id d14csp4430lfv; Tue, 12 Apr 2022 14:57:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy350jgxCn0waiF7ujr5pYX0bIU+FZiDvo4zYYiDvAsTedkg2t8N40126X8coL9gXvAwkx0 X-Received: by 2002:a63:4f1b:0:b0:39d:74b0:6e4f with SMTP id d27-20020a634f1b000000b0039d74b06e4fmr7172292pgb.76.1649800637289; Tue, 12 Apr 2022 14:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649800637; cv=none; d=google.com; s=arc-20160816; b=oL1vOOFqWZrmWjYrpT1he/4Lt1jiu54h2aO4lx+hD+hAZotTeHC3JS8cB/JFHyuOX6 xDKSJPkqd8D5BRxgeWlCAu+yBjXykEdO56TT8mp7HLYEoqm0vA3a/xTQOvxij14hVLxj do3Gwel5TkPULzuliAe+BDmB66j6OiivVRnDUs41X3ca1aK2+EP4Y7uQ5836bGvOJOpX eegxWj9ihsJyln8Lo1A7XZ/UDR2tGLCcrmJICxZR8Kc4LRbFWL+UL1bHIcpu0TGRNOy4 0iaGpU52mQl/ge/gbPiCWGtX651Qsh7dH2R/QdL1AqntnymmnpMxIzYDWoyFTL/rhaDc 1c8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=LmC2G1kIC2bjPYIdvitbx5KXueFp/+sexGyQ4odL7qI=; b=n1m2Nmr8bc10eOlsYXgPhIdLUEMWxqjv2x55Y6dkF4STE+0QA2RUrx9WJqhTEQJBXz 6/jfDfbA1vPyCnIXn0W1cU6dpd0miM3XGEib0BAUeifqhMW8wM59yN2ZTOLowHugSXdy RJfxbULQWyxOL20G0Vlor/H047SVLB8jcgTcGxEwvoGr8KdCy7uxxMnqRmL7Xx+O6Y7M fvB7nEN+D3Rs0Sj8kRnRQruxKB7ky6Xk1TzueskGgrcDlakos8WsXWEvhU3W4kH3ENhR EjucCKY/wdQWE6lh/pOH9xrZ7YNowOJZz0W80YVzIKgWMZdmCOAycfWrBTaZj11RGZwb vGJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WBvobLH5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 37-20020a631865000000b0039d599bc052si3640811pgy.49.2022.04.12.14.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 14:57:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WBvobLH5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DC5D097B82; Tue, 12 Apr 2022 13:49:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379271AbiDLKTo (ORCPT + 99 others); Tue, 12 Apr 2022 06:19:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354330AbiDLKDX (ORCPT ); Tue, 12 Apr 2022 06:03:23 -0400 Received: from mail-vs1-xe2c.google.com (mail-vs1-xe2c.google.com [IPv6:2607:f8b0:4864:20::e2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FE786E8F6; Tue, 12 Apr 2022 02:10:30 -0700 (PDT) Received: by mail-vs1-xe2c.google.com with SMTP id u2so13636675vsl.6; Tue, 12 Apr 2022 02:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LmC2G1kIC2bjPYIdvitbx5KXueFp/+sexGyQ4odL7qI=; b=WBvobLH5KLi6Jflqi4+K9mLcfHiASYqCcI9tr6wtc5F8ebkEW2Hp2dBLHpaJID78hB XMzIYXVY/guqlwBP5rwvCPA/w/ZaLgMrdJTscqTkmRGIBLEajBtLrZGVOmqpyCFe5n4N xZPTbjnLKiuJGye6o0olrzZrmj9XlEFJ1rnjErRXGo/eRgkgGStcZnHy+2tKZr2QppyE szBMAoOmPDyvDSRYwCJiM7CxbthSHwTPQFvrQQpRJP/nlOHXwwogt/WKkUKiVhqHiM45 cIsRmm/VTJB4qT/zml8EVFdVXo23lgGIEEO4ugfKw2NEN3ISysd1mTvWX1AXvlgSfnA6 sUzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LmC2G1kIC2bjPYIdvitbx5KXueFp/+sexGyQ4odL7qI=; b=N1iazT2sqe36XDrIS1QnRuOLHZZAYMKkEiACFBEF5cjxtL6gW0Gu76xW0vlvERQoOq IB63b/K3zUZXOi2vlkcBXdtA65bKXT5ufWlM79rhuco+BBnmNmkk2ZyfNOrOf2mFDjPp ZlESYac75GIi7x525NH9+JCpjz+3a1XP2B1uV2vWPAKtHFqeqwm+goUN9t/OYVRRqFSO NIFmJSNFGoSQpyL77Z2SwjEddQqSe4YdPk7dvCj4BD6sULR0q/F8Hjp47j6O8nazVyov cFO32h8TsRFts6SwTvOWnrwV1eHm/+JVbDtCP5VQ0raR4qDjHa1VV22lHVuG+21vgst3 YNgA== X-Gm-Message-State: AOAM5310m45UMjHBb/ABWsbWt/Uw839UCbKFdaPBZPqJXvP+879+NRtY By3qEEZ8hzlBeQQpvTrBtRukjlbf7ydz/BUalJc= X-Received: by 2002:a67:cd85:0:b0:329:c97:af2f with SMTP id r5-20020a67cd85000000b003290c97af2fmr524126vsl.6.1649754629222; Tue, 12 Apr 2022 02:10:29 -0700 (PDT) MIME-Version: 1.0 References: <20220412064940.14798-1-guozhengkui@vivo.com> In-Reply-To: <20220412064940.14798-1-guozhengkui@vivo.com> From: Ilya Dryomov Date: Tue, 12 Apr 2022 11:11:11 +0200 Message-ID: Subject: Re: [PATCH linux-next] net: ceph: use swap() macro instead of taking tmp variable To: Guo Zhengkui Cc: Jeff Layton , Xiubo Li , "David S. Miller" , Jakub Kicinski , Paolo Abeni , "open list:CEPH COMMON CODE (LIBCEPH)" , "open list:NETWORKING [GENERAL]" , open list , zhengkui_guo@outlook.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Tue, Apr 12, 2022 at 9:01 AM Guo Zhengkui wrote: > > Fix the following coccicheck warning: > net/ceph/crush/mapper.c:1077:8-9: WARNING opportunity for swap() > > by using swap() for the swapping of variable values and drop > the tmp variable that is not needed any more. > > Signed-off-by: Guo Zhengkui > --- > net/ceph/crush/mapper.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c > index 7057f8db4f99..1daf95e17d67 100644 > --- a/net/ceph/crush/mapper.c > +++ b/net/ceph/crush/mapper.c > @@ -906,7 +906,6 @@ int crush_do_rule(const struct crush_map *map, > int recurse_to_leaf; > int wsize = 0; > int osize; > - int *tmp; > const struct crush_rule *rule; > __u32 step; > int i, j; > @@ -1073,9 +1072,7 @@ int crush_do_rule(const struct crush_map *map, > memcpy(o, c, osize*sizeof(*o)); > > /* swap o and w arrays */ > - tmp = o; > - o = w; > - w = tmp; > + swap(o, w); > wsize = osize; > break; > > -- > 2.20.1 > Applied. Thanks, Ilya