From patchwork Wed Nov 24 03:16:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: CGEL X-Patchwork-Id: 12635907 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAE17C433EF for ; Wed, 24 Nov 2021 03:17:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FF3C6B0075; Tue, 23 Nov 2021 22:17:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AE5E6B0078; Tue, 23 Nov 2021 22:17:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59B046B007B; Tue, 23 Nov 2021 22:17:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id 4E0F76B0075 for ; Tue, 23 Nov 2021 22:17:05 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 09C7E1850E10C for ; Wed, 24 Nov 2021 03:16:55 +0000 (UTC) X-FDA: 78842362032.10.AABE486 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by imf08.hostedemail.com (Postfix) with ESMTP id 6A4FA300024B for ; Wed, 24 Nov 2021 03:16:50 +0000 (UTC) Received: by mail-qt1-f171.google.com with SMTP id t11so1349336qtw.3 for ; Tue, 23 Nov 2021 19:16:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cTp9yZLPAioGvr+AUfhjJxCDu9lVAek1x4B5RUtmqPw=; b=idantvmKEY5mzlBZUu5hJipAc4fwB3Qjt+8W4rDrxORm6ix8cGAHDyOCnRvkTen6FD C36Y9N/XjU1ZHW5S9KzIS/u77uw/FxOnC3JDCNgCADePTvkrv7v9ywTtZh7EIl9dXzpk R2Ry265R5byS71+65pJ9b0XbT30eHZW52jcY+OrJBfFmxyzoPrIbtlElY/vbfHYyQ8ep Iey87eFLOIzs9TMDkXk8NjgdHBmivB4zWevpO8o5GTa5w+bC6D4fcyIqK8m6UENWteOC nSpV0M6XCEyS36HGEjF5N2tij+rHqTyuS208oxOJWpuA/AXHq9omCoILaJS7wAtKvtYr pTXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cTp9yZLPAioGvr+AUfhjJxCDu9lVAek1x4B5RUtmqPw=; b=3uUtvnXlOeRRtcReUonz7Scb7hZ8uCwmc2TseI3zNWwgeUvepESXGMFkkfpe/KFLog z+mEt1FGSa9lkL+sU2VzhPxoZyMdB17XMtxhLxwXT165OEFutJjeJjApFuAdLttb2D5p 4SgnkDrHZbcHmIKozkgiGZO3oNUTqHqiXJOH1ijNN1MCiKu05JRJiur7WoLD1VIFyRa+ 1yqmxz2LXEIUk22y+5s+Raw0BtturKZglBmybcTl4hzU/T+qFkSIYASQCeWh0/HKpR5J t8M/bunlsDFGR91O1rtLAOFjJefRvO6Cwf8SsaQ4dmrmmc0W0ldaON/5shmMR+nMR+gD Qeaw== X-Gm-Message-State: AOAM532nYpQgOVJQxghIarHA4SKfwE9VJEpK55Z8ECqXNN2RAPYjHmD4 JLOfn0Oatf7gJc/JE53rm7mfLsCkh9I= X-Google-Smtp-Source: ABdhPJxI27GYfxwVe5N2/QtmsxifdzSx3qi4BT9bBjRKClUfabcC6peDTBh825e5skl+CK7EW76DFw== X-Received: by 2002:a05:622a:144f:: with SMTP id v15mr2993881qtx.340.1637723814121; Tue, 23 Nov 2021 19:16:54 -0800 (PST) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id bj30sm7510823qkb.58.2021.11.23.19.16.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 19:16:53 -0800 (PST) From: cgel.zte@gmail.com X-Google-Original-From: chi.minghao@zte.com.cn To: akpm@linux-foundation.org Cc: shuah@kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, chiminghao , Zeal Robot Subject: [PATCH] selftests:vm: use swap() to make code cleaner Date: Wed, 24 Nov 2021 03:16:32 +0000 Message-Id: <20211124031632.35317-1-chi.minghao@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 6A4FA300024B X-Stat-Signature: jcfayhdc71rbtonupfnwrbdn51fqfmki Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=idantvmK; spf=pass (imf08.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.160.171 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1637723810-608540 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: chiminghao Fix the following coccicheck REVIEW: ./tools/testing/selftests/vm/userfaultfd.c:1531:21-22:use swap() to make code cleaner Reported-by: Zeal Robot Signed-off-by: chiminghao --- tools/testing/selftests/vm/userfaultfd.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index 8a09057d2f22..dedbe9c9287e 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -1413,7 +1413,6 @@ static void userfaultfd_pagemap_test(unsigned int test_pgsize) static int userfaultfd_stress(void) { void *area; - char *tmp_area; unsigned long nr; struct uffdio_register uffdio_register; struct uffd_stats uffd_stats[nr_cpus]; @@ -1524,13 +1523,9 @@ static int userfaultfd_stress(void) count_verify[nr], nr); /* prepare next bounce */ - tmp_area = area_src; - area_src = area_dst; - area_dst = tmp_area; + swap(area_src, area_dst); - tmp_area = area_src_alias; - area_src_alias = area_dst_alias; - area_dst_alias = tmp_area; + swap(area_src_alias, area_dst_alias); uffd_stats_report(uffd_stats, nr_cpus); }