summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJiapeng Chong <jiapeng.chong@linux.alibaba.com>2022-01-29 11:48:47 +0800
committerMichael Ellerman <mpe@ellerman.id.au>2022-05-04 19:37:45 +1000
commit2077631917591650fdab5ec62717fd291a39b050 (patch)
tree2008045f31d9dd0cd5e9478f5c7990351b3f0d87 /arch
parente9bb94cde12d14e460b954f468af1200856564cf (diff)
downloadlinux-stable-2077631917591650fdab5ec62717fd291a39b050.tar.gz
linux-stable-2077631917591650fdab5ec62717fd291a39b050.tar.bz2
linux-stable-2077631917591650fdab5ec62717fd291a39b050.zip
powerpc/fadump: Use swap() instead of open coding it
Clean the following coccicheck warning: ./arch/powerpc/kernel/fadump.c:1291:34-35: WARNING opportunity for swap(). Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220129034847.76902-1-jiapeng.chong@linux.alibaba.com
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/fadump.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 0874684683a4..b59ee7053bba 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -1285,7 +1285,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;
@@ -1300,11 +1299,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 */