[PATCH] sparc64: Remove redundant NULL checks before kfree

From: cgel . zte
Date: Sun Jun 05 2022 - 21:45:41 EST


From: Minghao Chi <chi.minghao@xxxxxxxxxx>

Checking a pointer for NULL before calling kfree() on it is redundant,
kfree() deals with NULL pointers just fine.

Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: Minghao Chi <chi.minghao@xxxxxxxxxx>
---
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