[PATCH] redundant NULL checks before kfree should go away...

2005-04-11 Thread Jesper Juhl
(keeping me on CC when replying will be appreciated, thanks)


kfree() checks for NULL pointers. Checking prior to calling it is 
reundant.
This patch removes such redundant checks from arch/ppc64/

Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]>

diff -upr linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/lparcfg.c 
linux-2.6.12-rc2-mm3/arch/ppc64/kernel/lparcfg.c
--- linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/lparcfg.c   2005-04-05 
21:21:14.0 +0200
+++ linux-2.6.12-rc2-mm3/arch/ppc64/kernel/lparcfg.c2005-04-11 
22:23:37.0 +0200
@@ -597,9 +597,7 @@ int __init lparcfg_init(void)
 void __exit lparcfg_cleanup(void)
 {
if (proc_ppc64_lparcfg) {
-   if (proc_ppc64_lparcfg->data) {
-   kfree(proc_ppc64_lparcfg->data);
-   }
+   kfree(proc_ppc64_lparcfg->data);
remove_proc_entry("lparcfg", proc_ppc64_lparcfg->parent);
}
 }
diff -upr linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/pSeries_reconfig.c 
linux-2.6.12-rc2-mm3/arch/ppc64/kernel/pSeries_reconfig.c
--- linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/pSeries_reconfig.c  
2005-04-05 21:21:14.0 +0200
+++ linux-2.6.12-rc2-mm3/arch/ppc64/kernel/pSeries_reconfig.c   2005-04-11 
22:25:01.0 +0200
@@ -294,10 +294,8 @@ static struct property *new_property(con
return new;
 
 cleanup:
-   if (new->name)
-   kfree(new->name);
-   if (new->value)
-   kfree(new->value);
+   kfree(new->name);
+   kfree(new->value);
kfree(new);
return NULL;
 }
diff -upr linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/rtas_flash.c 
linux-2.6.12-rc2-mm3/arch/ppc64/kernel/rtas_flash.c
--- linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/rtas_flash.c2005-04-05 
21:21:14.0 +0200
+++ linux-2.6.12-rc2-mm3/arch/ppc64/kernel/rtas_flash.c 2005-04-11 
22:25:49.0 +0200
@@ -565,8 +565,7 @@ static int validate_flash_release(struct
 static void remove_flash_pde(struct proc_dir_entry *dp)
 {
if (dp) {
-   if (dp->data != NULL)
-   kfree(dp->data);
+   kfree(dp->data);
dp->owner = NULL;
remove_proc_entry(dp->name, dp->parent);
}
diff -upr linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/scanlog.c 
linux-2.6.12-rc2-mm3/arch/ppc64/kernel/scanlog.c
--- linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/scanlog.c   2005-04-05 
21:21:14.0 +0200
+++ linux-2.6.12-rc2-mm3/arch/ppc64/kernel/scanlog.c2005-04-11 
22:26:11.0 +0200
@@ -234,8 +234,7 @@ int __init scanlog_init(void)
 void __exit scanlog_cleanup(void)
 {
if (proc_ppc64_scan_log_dump) {
-   if (proc_ppc64_scan_log_dump->data)
-   kfree(proc_ppc64_scan_log_dump->data);
+   kfree(proc_ppc64_scan_log_dump->data);
remove_proc_entry("scan-log-dump", 
proc_ppc64_scan_log_dump->parent);
}
 }



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] redundant NULL checks before kfree should go away...

2005-04-11 Thread Jesper Juhl
(keeping me on CC when replying will be appreciated, thanks)


kfree() checks for NULL pointers. Checking prior to calling it is 
reundant.
This patch removes such redundant checks from arch/ppc64/

Signed-off-by: Jesper Juhl [EMAIL PROTECTED]

diff -upr linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/lparcfg.c 
linux-2.6.12-rc2-mm3/arch/ppc64/kernel/lparcfg.c
--- linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/lparcfg.c   2005-04-05 
21:21:14.0 +0200
+++ linux-2.6.12-rc2-mm3/arch/ppc64/kernel/lparcfg.c2005-04-11 
22:23:37.0 +0200
@@ -597,9 +597,7 @@ int __init lparcfg_init(void)
 void __exit lparcfg_cleanup(void)
 {
if (proc_ppc64_lparcfg) {
-   if (proc_ppc64_lparcfg-data) {
-   kfree(proc_ppc64_lparcfg-data);
-   }
+   kfree(proc_ppc64_lparcfg-data);
remove_proc_entry(lparcfg, proc_ppc64_lparcfg-parent);
}
 }
diff -upr linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/pSeries_reconfig.c 
linux-2.6.12-rc2-mm3/arch/ppc64/kernel/pSeries_reconfig.c
--- linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/pSeries_reconfig.c  
2005-04-05 21:21:14.0 +0200
+++ linux-2.6.12-rc2-mm3/arch/ppc64/kernel/pSeries_reconfig.c   2005-04-11 
22:25:01.0 +0200
@@ -294,10 +294,8 @@ static struct property *new_property(con
return new;
 
 cleanup:
-   if (new-name)
-   kfree(new-name);
-   if (new-value)
-   kfree(new-value);
+   kfree(new-name);
+   kfree(new-value);
kfree(new);
return NULL;
 }
diff -upr linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/rtas_flash.c 
linux-2.6.12-rc2-mm3/arch/ppc64/kernel/rtas_flash.c
--- linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/rtas_flash.c2005-04-05 
21:21:14.0 +0200
+++ linux-2.6.12-rc2-mm3/arch/ppc64/kernel/rtas_flash.c 2005-04-11 
22:25:49.0 +0200
@@ -565,8 +565,7 @@ static int validate_flash_release(struct
 static void remove_flash_pde(struct proc_dir_entry *dp)
 {
if (dp) {
-   if (dp-data != NULL)
-   kfree(dp-data);
+   kfree(dp-data);
dp-owner = NULL;
remove_proc_entry(dp-name, dp-parent);
}
diff -upr linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/scanlog.c 
linux-2.6.12-rc2-mm3/arch/ppc64/kernel/scanlog.c
--- linux-2.6.12-rc2-mm3-orig/arch/ppc64/kernel/scanlog.c   2005-04-05 
21:21:14.0 +0200
+++ linux-2.6.12-rc2-mm3/arch/ppc64/kernel/scanlog.c2005-04-11 
22:26:11.0 +0200
@@ -234,8 +234,7 @@ int __init scanlog_init(void)
 void __exit scanlog_cleanup(void)
 {
if (proc_ppc64_scan_log_dump) {
-   if (proc_ppc64_scan_log_dump-data)
-   kfree(proc_ppc64_scan_log_dump-data);
+   kfree(proc_ppc64_scan_log_dump-data);
remove_proc_entry(scan-log-dump, 
proc_ppc64_scan_log_dump-parent);
}
 }



-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/