]> err.no Git - linux-2.6/commitdiff
[PATCH] kfree cleanup: arch
authorJesper Juhl <jesper.juhl@gmail.com>
Mon, 7 Nov 2005 09:01:35 +0000 (01:01 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 7 Nov 2005 15:54:06 +0000 (07:54 -0800)
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: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Grant Grundler <grundler@parisc-linux.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
12 files changed:
arch/arm/mach-integrator/impd1.c
arch/cris/arch-v32/drivers/cryptocop.c
arch/ia64/kernel/perfmon.c
arch/powerpc/platforms/pseries/reconfig.c
arch/ppc/8xx_io/cs4218_tdm.c
arch/ppc/syslib/prom.c
arch/ppc64/kernel/lparcfg.c
arch/ppc64/kernel/scanlog.c
arch/s390/mm/extmem.c
arch/sparc64/kernel/us2e_cpufreq.c
arch/sparc64/kernel/us3_cpufreq.c
arch/um/kernel/sigio_user.c

index a1b153d1626cf182b6fa952c31daedfc6bb8528a..a4bafee77a06d0389269981a370a01192033096a 100644 (file)
@@ -420,8 +420,7 @@ static int impd1_probe(struct lm_device *dev)
  free_impd1:
        if (impd1 && impd1->base)
                iounmap(impd1->base);
-       if (impd1)
-               kfree(impd1);
+       kfree(impd1);
  release_lm:
        release_mem_region(dev->resource.start, SZ_4K);
        return ret;
index ca72076c630a9efee555ab7894983f70633d0357..501fa52d8d3a1974285b1d8c1d0e9e73444f9f37 100644 (file)
@@ -277,7 +277,7 @@ struct file_operations cryptocop_fops = {
 static void free_cdesc(struct cryptocop_dma_desc *cdesc)
 {
        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) {
                unsigned long int flags;
@@ -2950,15 +2950,15 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig
                put_page(outpages[i]);
        }
 
-       if (digest_result) kfree(digest_result);
-       if (inpages) kfree(inpages);
-       if (outpages) kfree(outpages);
+       kfree(digest_result);
+       kfree(inpages);
+       kfree(outpages);
        if (cop){
-               if (cop->tfrm_op.indata) kfree(cop->tfrm_op.indata);
-               if (cop->tfrm_op.outdata) kfree(cop->tfrm_op.outdata);
+               kfree(cop->tfrm_op.indata);
+               kfree(cop->tfrm_op.outdata);
                kfree(cop);
        }
-       if (jc) kfree(jc);
+       kfree(jc);
 
        DEBUG(print_lock_status());
 
index f7dfc107cb7bd6040eca8f4e7aa46b7531c4a443..410d4804fa6e0cb4086e6fb6af75760337a60d23 100644 (file)
@@ -4940,7 +4940,7 @@ abort_locked:
        if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT;
 
 error_args:
-       if (args_k) kfree(args_k);
+       kfree(args_k);
 
        DPRINT(("cmd=%s ret=%ld\n", PFM_CMD_NAME(cmd), ret));
 
index 58c61219d08e0765646450c30cba107936db01ab..d7d400339458d2e5e159bd67633bc919e8b8eed6 100644 (file)
@@ -286,10 +286,8 @@ static struct property *new_property(const char *name, const int length,
        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;
 }
index 532caa388dc258b9a90407d96a0a978c71854f9b..49eb2a7e65c0711a8ee2585b0ec2221210796c5a 100644 (file)
@@ -1013,8 +1013,7 @@ static void CS_IrqCleanup(void)
        */
        cpm_free_handler(CPMVEC_SMC2);
 
-       if (beep_buf)
-               kfree(beep_buf);
+       kfree(beep_buf);
        kd_mksound = orig_mksound;
 }
 #endif /* MODULE */
index 278da6ee62ea22f2c3bfa330562460d9c9e9e107..1b9aa0d6a924f5259446c9bbf9a09ac58c0cbfe4 100644 (file)
@@ -1335,10 +1335,8 @@ release_OF_resource(struct device_node* node, int index)
        if (!res)
                return -ENODEV;
 
-       if (res->name) {
-               kfree(res->name);
-               res->name = NULL;
-       }
+       kfree(res->name);
+       res->name = NULL;
        release_resource(res);
        kfree(res);
 
index e86155770bbc5ff761352dfc556b7c146295e77d..3e7b2f28ec8302a4b9025a5cdde84296b9c30e7e 100644 (file)
@@ -599,9 +599,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);
        }
 }
index 215bf8900304ea8aa135434feeb26b33b53c6c41..2edc947f7c44b2a9908f43ad098633018dc38bf6 100644 (file)
@@ -225,8 +225,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);
        }
 }
index c5348108ca3ce23e8da4a6681c32330ebad73122..506a33b51e4f789317a3a854fb7eef9221aa7827 100644 (file)
@@ -234,8 +234,8 @@ query_segment_type (struct dcss_segment *seg)
        rc = 0;
 
  out_free:
-       if (qin) kfree(qin);
-       if (qout) kfree(qout);
+       kfree(qin);
+       kfree(qout);
        return rc;
 }
 
@@ -394,7 +394,7 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
                                segtype_string[seg->vm_segtype]);
        goto out;
  out_free:
-       kfree (seg);
+       kfree(seg);
  out:
        return rc;
 }
@@ -505,7 +505,7 @@ segment_modify_shared (char *name, int do_nonshared)
        list_del(&seg->list);
        dcss_diag(DCSS_PURGESEG, seg->dcss_name,
                  &dummy, &dummy);
-       kfree (seg);
+       kfree(seg);
  out_unlock:
        spin_unlock(&dcss_lock);
        return rc;
index 686e526bec04c91ffe1e7c145537b1a74680fb20..b35dc8dc995a066810c5c4dac01658c4ab9f8944 100644 (file)
@@ -388,10 +388,8 @@ err_out:
                        kfree(driver);
                        cpufreq_us2e_driver = NULL;
                }
-               if (us2e_freq_table) {
-                       kfree(us2e_freq_table);
-                       us2e_freq_table = NULL;
-               }
+               kfree(us2e_freq_table);
+               us2e_freq_table = NULL;
                return ret;
        }
 
@@ -402,7 +400,6 @@ static void __exit us2e_freq_exit(void)
 {
        if (cpufreq_us2e_driver) {
                cpufreq_unregister_driver(cpufreq_us2e_driver);
-
                kfree(cpufreq_us2e_driver);
                cpufreq_us2e_driver = NULL;
                kfree(us2e_freq_table);
index 0340041f614352a5cd22ddae1a946c8b1cf53e0f..6d1f9a3c464f55ed63c158527ea6d88502606b7d 100644 (file)
@@ -249,10 +249,8 @@ err_out:
                        kfree(driver);
                        cpufreq_us3_driver = NULL;
                }
-               if (us3_freq_table) {
-                       kfree(us3_freq_table);
-                       us3_freq_table = NULL;
-               }
+               kfree(us3_freq_table);
+               us3_freq_table = NULL;
                return ret;
        }
 
@@ -263,7 +261,6 @@ static void __exit us3_freq_exit(void)
 {
        if (cpufreq_us3_driver) {
                cpufreq_unregister_driver(cpufreq_us3_driver);
-
                kfree(cpufreq_us3_driver);
                cpufreq_us3_driver = NULL;
                kfree(us3_freq_table);
index 3fbfd956bfe7a297e12d6994d273a49735d34340..48b1f644b9a624a66ce16c782c832d84c4c2a074 100644 (file)
@@ -224,7 +224,7 @@ static int need_poll(int n)
                next_poll.used = n;
                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));
        if(next_poll.poll == NULL){
                printk("need_poll : failed to allocate new pollfds\n");