* [PATCH] powerpc/fadump: Use swap() instead of open coding it
@ 2022-01-29 3:48 Jiapeng Chong
0 siblings, 0 replies; only message in thread
From: Jiapeng Chong @ 2022-01-29 3:48 UTC (permalink / raw)
To: mpe; +Cc: Jiapeng Chong, Abaci Robot, linux-kernel, paulus, linuxppc-dev
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>
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-29 3:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-29 3:48 [PATCH] powerpc/fadump: Use swap() instead of open coding it Jiapeng Chong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox