* [PATCH] sparc64: Remove redundant NULL checks before kfree
@ 2022-06-06 1:45 cgel.zte
0 siblings, 0 replies; only message in thread
From: cgel.zte @ 2022-06-06 1:45 UTC (permalink / raw)
To: davem; +Cc: sparclinux, linux-kernel, Minghao Chi, Zeal Robot
From: Minghao Chi <chi.minghao@zte.com.cn>
Checking a pointer for NULL before calling kfree() on it is redundant,
kfree() deals with NULL pointers just fine.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
arch/sparc/kernel/cpumap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/sparc/kernel/cpumap.c b/arch/sparc/kernel/cpumap.c
index f07ea88a83af..1ae22b0d938c 100644
--- a/arch/sparc/kernel/cpumap.c
+++ b/arch/sparc/kernel/cpumap.c
@@ -352,10 +352,8 @@ static void _cpu_map_rebuild(void)
{
int i;
- if (cpuinfo_tree) {
- kfree(cpuinfo_tree);
- cpuinfo_tree = NULL;
- }
+ kfree(cpuinfo_tree);
+ cpuinfo_tree = NULL;
cpuinfo_tree = build_cpuinfo_tree();
if (!cpuinfo_tree)
--
2.25.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-06 1:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06 1:45 [PATCH] sparc64: Remove redundant NULL checks before kfree cgel.zte
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®