Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4713343iob; Sun, 8 May 2022 22:58:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeqpO4/NbE3ygyZeKPN/4ccCmZdq2ReIv5kDUozyetRMXyHUFtiWCC8nnxs2rPnQ3GLNsp X-Received: by 2002:a65:6216:0:b0:39d:5e6c:7578 with SMTP id d22-20020a656216000000b0039d5e6c7578mr11722945pgv.114.1652075920530; Sun, 08 May 2022 22:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652075920; cv=none; d=google.com; s=arc-20160816; b=u581Sq14HhjveXyEhElBIPpRgC+WaAxX4Zu/AE8GwwBIdfx9PDzuFpTXEg+cW/2zbN HhpI6wotb4vdGTKRkqZmvLpLqVNmwi1RrHWh2WuS98Kb4KhQkeIjORinz6z0H+lmrXs8 V2Hvg83g2kRWMrK20375jPp/DtWYMBUlwQJrqro6YZpgok/ock8IedadXtp/E/R+ONX6 c433p6N6bXU6sRhitQ8P7m6w5ABsHLP9CsRyM2a2Cmfku4OEI+/7fjDQ8w8bD0F2N/BF ly7CNiUB4n44st5skBiHUEBLJh6mrXpEC27S7AiYyH+A5byd56BJTFDljaPWD68fIFru iLGg== 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=UUzOVRyaheEdWm58SlA3BCw55zT72TYhV0LSX4QMv1w=; b=RsWI4wZaWZWtTNxE2J/Tatk+uOPMDUUgem0ykmuM+r2kgzCs7qEclXxArlhv3jrG4m mzFSppFg5rI0lBGLnkzoSQqPLhiq2Qakd419U66RVXnhlqVXOijoW6U6ZLwuWB5BtJHr x4RRkIuDkajtzI+xIGwqbcdtgwOCFGJZ6PZP88BR12pbPMqEZLl0OKg0jTxzKm6rjmq7 y4klVwmpY320FkxD1DN0igj9om4B+97XsLLQtQtAfGaCUJkLp0CwaYQraJlBm0V+/TEZ ox7hmU7rgc1ssoJ0LHLWZD1MyM+1Iuk1P/7r4gyD/YYpDlES+ygsTNQnjhzzR0D1EHor ToDA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q10-20020a056a00084a00b00505b033e35fsi15119254pfk.71.2022.05.08.22.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 22:58:40 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 148EB326E5; Sun, 8 May 2022 22:55:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390385AbiEFJVW (ORCPT + 99 others); Fri, 6 May 2022 05:21:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237323AbiEFJVP (ORCPT ); Fri, 6 May 2022 05:21:15 -0400 Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5FC9633AE; Fri, 6 May 2022 02:17:32 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=19;SR=0;TI=SMTPD_---0VCRMaGr_1651828640; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VCRMaGr_1651828640) by smtp.aliyun-inc.com(127.0.0.1); Fri, 06 May 2022 17:17:28 +0800 From: Jiapeng Chong To: john.garry@huawei.com Cc: will@kernel.org, mathieu.poirier@linaro.org, leo.yan@linaro.org, suzuki.poulose@arm.com, mike.leach@linaro.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] perf cs-etm: Use swap() instead of open coding it Date: Fri, 6 May 2022 17:17:18 +0800 Message-Id: <20220506091718.82858-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=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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 Clean the following coccicheck warning: ./tools/perf/util/cs-etm.c:418:34-35: WARNING opportunity for swap(). Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- tools/perf/util/cs-etm.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 8b95fb3c4d7b..0cb555cc766f 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -406,18 +406,13 @@ struct cs_etm_packet_queue static void cs_etm__packet_swap(struct cs_etm_auxtrace *etm, struct cs_etm_traceid_queue *tidq) { - struct cs_etm_packet *tmp; - if (etm->synth_opts.branches || etm->synth_opts.last_branch || - etm->synth_opts.instructions) { + etm->synth_opts.instructions) /* * Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for * the next incoming packet. */ - tmp = tidq->packet; - tidq->packet = tidq->prev_packet; - tidq->prev_packet = tmp; - } + swap(tidq->packet, tidq->prev_packet); } static void cs_etm__packet_dump(const char *pkt_string) -- 2.20.1.7.g153144c