Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp51634pxb; Mon, 31 Jan 2022 15:00:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgRX9FHNdEJJdSxLNHk18nHiYsMS+vUtFumZdDhK612HkZDTxrvA6RhDCfrmzYCbeWlbgl X-Received: by 2002:a17:90b:146:: with SMTP id em6mr37022211pjb.214.1643670048473; Mon, 31 Jan 2022 15:00:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643670048; cv=none; d=google.com; s=arc-20160816; b=Qt+/TeM/bbiuBRoTpPhBi36oKVzzW8z3creytBB4kjnW5nPn5wdvBRk3+vHlJ3FH9Y HQKiVS3pnJA7nGpCnBd1GpssScqGqSC/B6qlSumZKuzNibe6oQ6gUY4kvP3NMQsK+6Xk XrKV5FGn7Ei4tQoCmI5Cp25tM1iG3+seORpBVy4wt4eH1b9x0gNB7tuZkcZl14efmJZR Z7zGlQj1BNpw/kmPNpcA1lIwgdPmeMPMt9K6Xtyk56JA5oJ0/MEJ6+GcA5pKp8iL/Kzq BYi1j8IHxFcwvB4EyO1cXcyfHZY1M4eh3VyG9tg04uBzDLGf9VQVwF+z+rblwjGCl2AW uc3g== 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=YUKctQGsczSsDWfoJekZtZTmUfOk9ZyUp44Oa58/cXg=; b=Zebn3Cqy3kjFgxs5ypNB3ApojLvY7n5z27zXtoWw0RrwmCD4vnVvJg6jGN050Y7W1Q cmeFZEWXNJ+vvpbeW6ywVPA6Z9iYxxtAbfQ9XBJMgDSVlI1NVpThFSbnOYa/U/gkpu8w 6lftySNqdfnCGQPij2GlrwWQ7GSy4765JKF4HSigS9qc0DnlgLmMu3oHCN8EDnekQ3dW neCVkgksQ/aWwYcQmBb20m+1Mhx87EuJc2NTQlOiWKuQpYB4rtP6oGbkPNFbeYv67M8I TLznjpj8gBtqkUn+j7UKW0g/ZLn3y4XFYJRZ3hZTp1K4h19L13SfiqwRdo1DP34jbOFv hdDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i19si5160767pfd.287.2022.01.31.15.00.35; Mon, 31 Jan 2022 15:00:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352320AbiA2DtC (ORCPT + 99 others); Fri, 28 Jan 2022 22:49:02 -0500 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:60992 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238931AbiA2Ds5 (ORCPT ); Fri, 28 Jan 2022 22:48:57 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0V35EraQ_1643428129; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0V35EraQ_1643428129) by smtp.aliyun-inc.com(127.0.0.1); Sat, 29 Jan 2022 11:48:54 +0800 From: Jiapeng Chong To: mpe@ellerman.id.au Cc: benh@kernel.crashing.org, paulus@samba.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] powerpc/fadump: Use swap() instead of open coding it Date: Sat, 29 Jan 2022 11:48:47 +0800 Message-Id: <20220129034847.76902-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clean the following coccicheck warning: ./arch/powerpc/kernel/fadump.c:1291:34-35: WARNING opportunity for swap(). Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- arch/powerpc/kernel/fadump.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index d0ad86b67e66..de08dd078081 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -1271,7 +1271,6 @@ static void fadump_release_reserved_area(u64 start, u64 end) static void sort_and_merge_mem_ranges(struct fadump_mrange_info *mrange_info) { struct fadump_memory_range *mem_ranges; - struct fadump_memory_range tmp_range; u64 base, size; int i, j, idx; @@ -1286,11 +1285,8 @@ static void sort_and_merge_mem_ranges(struct fadump_mrange_info *mrange_info) if (mem_ranges[idx].base > mem_ranges[j].base) idx = j; } - if (idx != i) { - tmp_range = mem_ranges[idx]; - mem_ranges[idx] = mem_ranges[i]; - mem_ranges[i] = tmp_range; - } + if (idx != i) + swap(mem_ranges[idx], mem_ranges[i]); } /* Merge adjacent reserved ranges */ -- 2.20.1.7.g153144c