Skip to contentSkip to conversation

Remove redundant NULL checks before [kv]free - in arch/

PATCH In review Jesper Juhl 3 participants 3 messages Apr 17, 2006 – Apr 26, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/5 Remove redundant NULL checks before [kv]free - in arch/

Remove redundant NULL checks before [kv]free + small CodingStyle cleanup for arch/

---

 arch/ia64/kernel/topology.c               |    7 --
 arch/ia64/sn/kernel/xpc_partition.c       |    8 --
 arch/powerpc/platforms/powermac/low_i2c.c |    3
 arch/um/kernel/irq.c                      |   93 +++++++++++++++---------------
 arch/um/os-Linux/irq.c                    |   47 +++++++--------
 5 files changed, 74 insertions(+), 84 deletions(-)
arch/ia64/kernel/topology.c +2 -5
diff -upr linux-2.6.17-rc1-git12-orig/arch/ia64/kernel/topology.c linux-2.6.17-rc1-git12/arch/ia64/kernel/topology.c
@@ -305,13 +305,10 @@ static struct kobj_type cache_ktype_perc
 
 static void __cpuinit cpu_cache_sysfs_exit(unsigned int cpu)
 {
-	if (all_cpu_cache_info[cpu].cache_leaves) {
-		kfree(all_cpu_cache_info[cpu].cache_leaves);
-		all_cpu_cache_info[cpu].cache_leaves = NULL;
-	}
+	kfree(all_cpu_cache_info[cpu].cache_leaves);
+	all_cpu_cache_info[cpu].cache_leaves = NULL;
 	all_cpu_cache_info[cpu].num_cache_leaves = 0;
 	memset(&all_cpu_cache_info[cpu].kobj, 0, sizeof(struct kobject));
-
 	return;
 }
 
arch/ia64/sn/kernel/xpc_partition.c +2 -6
diff -upr linux-2.6.17-rc1-git12-orig/arch/ia64/sn/kernel/xpc_partition.c linux-2.6.17-rc1-git12/arch/ia64/sn/kernel/xpc_partition.c
@@ -136,9 +136,7 @@ xpc_get_rsvd_page_pa(int nasid)
 		}
 
 		if (L1_CACHE_ALIGN(len) > buf_len) {
-			if (buf_base != NULL) {
-				kfree(buf_base);
-			}
+			kfree(buf_base);
 			buf_len = L1_CACHE_ALIGN(len);
 			buf = (u64) xpc_kmalloc_cacheline_aligned(buf_len,
 							GFP_KERNEL, &buf_base);
@@ -159,9 +157,7 @@ xpc_get_rsvd_page_pa(int nasid)
 		}
 	}
 
-	if (buf_base != NULL) {
-		kfree(buf_base);
-	}
+	kfree(buf_base);
 
 	if (status != SALRET_OK) {
 		rp_pa = 0;
arch/powerpc/platforms/powermac/low_i2c.c +1 -2
diff -upr linux-2.6.17-rc1-git12-orig/arch/powerpc/platforms/powermac/low_i2c.c linux-2.6.17-rc1-git12/arch/powerpc/platforms/powermac/low_i2c.c
@@ -1265,8 +1265,7 @@ static void pmac_i2c_do_end(struct pmf_f
 	if (inst = NULL)
 		return;
 	pmac_i2c_close(inst->bus);
-	if (inst)
-		kfree(inst);
+	kfree(inst);
 }
 
 static int pmac_i2c_do_read(PMF_STD_ARGS, u32 len)
arch/um/kernel/irq.c +47 -46

256 lines not on this page · raw message

arch/um/os-Linux/irq.c +22 -25

111 lines not on this page · raw message

#1 lore raw
Quoted 8 lines · Jesper Juhl

Remove redundant NULL checks before [kv]free + small CodingStyle cleanup for arch/

---

 arch/ia64/kernel/topology.c               |    7 --
 arch/ia64/sn/kernel/xpc_partition.c       |    8 --

Applied ia64 pieces. Thanks.

Quoted 3 lines
 arch/powerpc/platforms/powermac/low_i2c.c |    3
 arch/um/kernel/irq.c                      |   93 +++++++++++++++---------------
 arch/um/os-Linux/irq.c                    |   47 +++++++--------

These bits left to fend for themselves in patchspace.

-Tony