[PATCH] sparc64: Remove redundant NULL checks before kfree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux