Commit b2325fe1 authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds

[PATCH] kfree cleanup: arch

This is the arch/ part of the big kfree cleanup patch.

Remove pointless checks for NULL prior to calling kfree() in arch/.
Signed-off-by: default avatarJesper Juhl <jesper.juhl@gmail.com>
Acked-by: default avatarGrant Grundler <grundler@parisc-linux.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f99d49ad
...@@ -420,8 +420,7 @@ static int impd1_probe(struct lm_device *dev) ...@@ -420,8 +420,7 @@ static int impd1_probe(struct lm_device *dev)
free_impd1: free_impd1:
if (impd1 && impd1->base) if (impd1 && impd1->base)
iounmap(impd1->base); iounmap(impd1->base);
if (impd1) kfree(impd1);
kfree(impd1);
release_lm: release_lm:
release_mem_region(dev->resource.start, SZ_4K); release_mem_region(dev->resource.start, SZ_4K);
return ret; return ret;
......
...@@ -277,7 +277,7 @@ struct file_operations cryptocop_fops = { ...@@ -277,7 +277,7 @@ struct file_operations cryptocop_fops = {
static void free_cdesc(struct cryptocop_dma_desc *cdesc) static void free_cdesc(struct cryptocop_dma_desc *cdesc)
{ {
DEBUG(printk("free_cdesc: cdesc 0x%p, from_pool=%d\n", cdesc, cdesc->from_pool)); DEBUG(printk("free_cdesc: cdesc 0x%p, from_pool=%d\n", cdesc, cdesc->from_pool));
if (cdesc->free_buf) kfree(cdesc->free_buf); kfree(cdesc->free_buf);
if (cdesc->from_pool) { if (cdesc->from_pool) {
unsigned long int flags; unsigned long int flags;
...@@ -2950,15 +2950,15 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig ...@@ -2950,15 +2950,15 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig
put_page(outpages[i]); put_page(outpages[i]);
} }
if (digest_result) kfree(digest_result); kfree(digest_result);
if (inpages) kfree(inpages); kfree(inpages);
if (outpages) kfree(outpages); kfree(outpages);
if (cop){ if (cop){
if (cop->tfrm_op.indata) kfree(cop->tfrm_op.indata); kfree(cop->tfrm_op.indata);
if (cop->tfrm_op.outdata) kfree(cop->tfrm_op.outdata); kfree(cop->tfrm_op.outdata);
kfree(cop); kfree(cop);
} }
if (jc) kfree(jc); kfree(jc);
DEBUG(print_lock_status()); DEBUG(print_lock_status());
......
...@@ -4940,7 +4940,7 @@ sys_perfmonctl (int fd, int cmd, void __user *arg, int count) ...@@ -4940,7 +4940,7 @@ sys_perfmonctl (int fd, int cmd, void __user *arg, int count)
if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT; if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT;
error_args: error_args:
if (args_k) kfree(args_k); kfree(args_k);
DPRINT(("cmd=%s ret=%ld\n", PFM_CMD_NAME(cmd), ret)); DPRINT(("cmd=%s ret=%ld\n", PFM_CMD_NAME(cmd), ret));
......
...@@ -286,10 +286,8 @@ static struct property *new_property(const char *name, const int length, ...@@ -286,10 +286,8 @@ static struct property *new_property(const char *name, const int length,
return new; return new;
cleanup: cleanup:
if (new->name) kfree(new->name);
kfree(new->name); kfree(new->value);
if (new->value)
kfree(new->value);
kfree(new); kfree(new);
return NULL; return NULL;
} }
......
...@@ -1013,8 +1013,7 @@ static void CS_IrqCleanup(void) ...@@ -1013,8 +1013,7 @@ static void CS_IrqCleanup(void)
*/ */
cpm_free_handler(CPMVEC_SMC2); cpm_free_handler(CPMVEC_SMC2);
if (beep_buf) kfree(beep_buf);
kfree(beep_buf);
kd_mksound = orig_mksound; kd_mksound = orig_mksound;
} }
#endif /* MODULE */ #endif /* MODULE */
......
...@@ -1335,10 +1335,8 @@ release_OF_resource(struct device_node* node, int index) ...@@ -1335,10 +1335,8 @@ release_OF_resource(struct device_node* node, int index)
if (!res) if (!res)
return -ENODEV; return -ENODEV;
if (res->name) { kfree(res->name);
kfree(res->name); res->name = NULL;
res->name = NULL;
}
release_resource(res); release_resource(res);
kfree(res); kfree(res);
......
...@@ -599,9 +599,7 @@ int __init lparcfg_init(void) ...@@ -599,9 +599,7 @@ int __init lparcfg_init(void)
void __exit lparcfg_cleanup(void) void __exit lparcfg_cleanup(void)
{ {
if (proc_ppc64_lparcfg) { 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); remove_proc_entry("lparcfg", proc_ppc64_lparcfg->parent);
} }
} }
......
...@@ -225,8 +225,7 @@ int __init scanlog_init(void) ...@@ -225,8 +225,7 @@ int __init scanlog_init(void)
void __exit scanlog_cleanup(void) void __exit scanlog_cleanup(void)
{ {
if (proc_ppc64_scan_log_dump) { 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); remove_proc_entry("scan-log-dump", proc_ppc64_scan_log_dump->parent);
} }
} }
......
...@@ -234,8 +234,8 @@ query_segment_type (struct dcss_segment *seg) ...@@ -234,8 +234,8 @@ query_segment_type (struct dcss_segment *seg)
rc = 0; rc = 0;
out_free: out_free:
if (qin) kfree(qin); kfree(qin);
if (qout) kfree(qout); kfree(qout);
return rc; return rc;
} }
...@@ -394,7 +394,7 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long ...@@ -394,7 +394,7 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
segtype_string[seg->vm_segtype]); segtype_string[seg->vm_segtype]);
goto out; goto out;
out_free: out_free:
kfree (seg); kfree(seg);
out: out:
return rc; return rc;
} }
...@@ -505,7 +505,7 @@ segment_modify_shared (char *name, int do_nonshared) ...@@ -505,7 +505,7 @@ segment_modify_shared (char *name, int do_nonshared)
list_del(&seg->list); list_del(&seg->list);
dcss_diag(DCSS_PURGESEG, seg->dcss_name, dcss_diag(DCSS_PURGESEG, seg->dcss_name,
&dummy, &dummy); &dummy, &dummy);
kfree (seg); kfree(seg);
out_unlock: out_unlock:
spin_unlock(&dcss_lock); spin_unlock(&dcss_lock);
return rc; return rc;
......
...@@ -388,10 +388,8 @@ static int __init us2e_freq_init(void) ...@@ -388,10 +388,8 @@ static int __init us2e_freq_init(void)
kfree(driver); kfree(driver);
cpufreq_us2e_driver = NULL; cpufreq_us2e_driver = NULL;
} }
if (us2e_freq_table) { kfree(us2e_freq_table);
kfree(us2e_freq_table); us2e_freq_table = NULL;
us2e_freq_table = NULL;
}
return ret; return ret;
} }
...@@ -402,7 +400,6 @@ static void __exit us2e_freq_exit(void) ...@@ -402,7 +400,6 @@ static void __exit us2e_freq_exit(void)
{ {
if (cpufreq_us2e_driver) { if (cpufreq_us2e_driver) {
cpufreq_unregister_driver(cpufreq_us2e_driver); cpufreq_unregister_driver(cpufreq_us2e_driver);
kfree(cpufreq_us2e_driver); kfree(cpufreq_us2e_driver);
cpufreq_us2e_driver = NULL; cpufreq_us2e_driver = NULL;
kfree(us2e_freq_table); kfree(us2e_freq_table);
......
...@@ -249,10 +249,8 @@ static int __init us3_freq_init(void) ...@@ -249,10 +249,8 @@ static int __init us3_freq_init(void)
kfree(driver); kfree(driver);
cpufreq_us3_driver = NULL; cpufreq_us3_driver = NULL;
} }
if (us3_freq_table) { kfree(us3_freq_table);
kfree(us3_freq_table); us3_freq_table = NULL;
us3_freq_table = NULL;
}
return ret; return ret;
} }
...@@ -263,7 +261,6 @@ static void __exit us3_freq_exit(void) ...@@ -263,7 +261,6 @@ static void __exit us3_freq_exit(void)
{ {
if (cpufreq_us3_driver) { if (cpufreq_us3_driver) {
cpufreq_unregister_driver(cpufreq_us3_driver); cpufreq_unregister_driver(cpufreq_us3_driver);
kfree(cpufreq_us3_driver); kfree(cpufreq_us3_driver);
cpufreq_us3_driver = NULL; cpufreq_us3_driver = NULL;
kfree(us3_freq_table); kfree(us3_freq_table);
......
...@@ -224,7 +224,7 @@ static int need_poll(int n) ...@@ -224,7 +224,7 @@ static int need_poll(int n)
next_poll.used = n; next_poll.used = n;
return(0); return(0);
} }
if(next_poll.poll != NULL) kfree(next_poll.poll); kfree(next_poll.poll);
next_poll.poll = um_kmalloc_atomic(n * sizeof(struct pollfd)); next_poll.poll = um_kmalloc_atomic(n * sizeof(struct pollfd));
if(next_poll.poll == NULL){ if(next_poll.poll == NULL){
printk("need_poll : failed to allocate new pollfds\n"); printk("need_poll : failed to allocate new pollfds\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment