From patchwork Fri May 6 09:17:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiapeng Chong X-Patchwork-Id: 12840776 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7785FC433EF for ; Fri, 6 May 2022 09:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=qC/iZ6IE/oQxKUofY5BTzQLKZqLKncdyG3D+hiZqypA=; b=z16Axo65EaETmq Cb/otw96A3zpSiNff1pF4xRzYGksZilRK+87ME/by233Re7L5WAAlRqvTGWRd/Cl3rctlENyDdeRn EpRHqCHng9WGSYa74qm1jUgEhJUgdeKMGqspbm2nd0eurSEKGijX0N7/k58KeuAVvgV6is37MyVp+ J4r3aVahbGrGLWciN/fw+rjT+LabxEl14d932FK9D2quQICpEp9BbUc/mjqQc5KMEnLdWK3XgtDQ1 +17TQlsaeVXyIPOXvUErGl9o+yTGc6XM/PvxaZ2yv8XOgvBv77umEW8IG6iBKCA1Cl92dMgZ7deCk WZDXgPdDh5yPzasd1GRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmu5g-002I40-5o; Fri, 06 May 2022 09:17:36 +0000 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmu5c-002I2m-Vg for linux-arm-kernel@lists.infradead.org; Fri, 06 May 2022 09:17:34 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220506_021733_211821_85A364F2 X-CRM114-Status: UNSURE ( 7.10 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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)