From nobody Sun May 10 09:54:39 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28FA3C433EF for ; Fri, 6 May 2022 09:17:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390387AbiEFJVW (ORCPT ); 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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 =3D tidq->packet; - tidq->packet =3D tidq->prev_packet; - tidq->prev_packet =3D tmp; - } + swap(tidq->packet, tidq->prev_packet); } =20 static void cs_etm__packet_dump(const char *pkt_string) --=20 2.20.1.7.g153144c