aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2005-11-07 04:01:30 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:54:03 -0500
commit17fd682e544556a2a829e94383239c029bb21c5e (patch)
tree4b78bdd36efdbf9fb2c4c11382ed88898ceec48c
parent3c7208f253571ee5f157b98f0e315b5172afe092 (diff)
[PATCH] kfree cleanup: drivers/s390
This is the drivers/s390/ part of the big kfree cleanup patch. Remove pointless checks for NULL prior to calling kfree() in drivers/s390/. Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Acked-by: Cornelia Huck <cohuck@de.ibm.com> Acked-by: Stefan Bader <Stefan.Bader@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/s390/block/dasd.c12
-rw-r--r--drivers/s390/block/dasd_devmap.c3
-rw-r--r--drivers/s390/char/con3215.c3
-rw-r--r--drivers/s390/char/keyboard.c15
-rw-r--r--drivers/s390/char/raw3270.c3
-rw-r--r--drivers/s390/char/tape_core.c9
-rw-r--r--drivers/s390/cio/cmf.c3
-rw-r--r--drivers/s390/cio/device_ops.c6
-rw-r--r--drivers/s390/cio/qdio.c9
-rw-r--r--drivers/s390/crypto/z90main.c7
-rw-r--r--drivers/s390/net/claw.c36
-rw-r--r--drivers/s390/net/fsm.c3
-rw-r--r--drivers/s390/net/iucv.c12
-rw-r--r--drivers/s390/net/lcs.c3
-rw-r--r--drivers/s390/net/qeth_eddp.c3
-rw-r--r--drivers/s390/scsi/zfcp_aux.c3
16 files changed, 44 insertions, 86 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 8fc891a9d47f..7008d32433bf 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -115,8 +115,7 @@ dasd_alloc_device(void)
115void 115void
116dasd_free_device(struct dasd_device *device) 116dasd_free_device(struct dasd_device *device)
117{ 117{
118 if (device->private) 118 kfree(device->private);
119 kfree(device->private);
120 free_page((unsigned long) device->erp_mem); 119 free_page((unsigned long) device->erp_mem);
121 free_pages((unsigned long) device->ccw_mem, 1); 120 free_pages((unsigned long) device->ccw_mem, 1);
122 kfree(device); 121 kfree(device);
@@ -539,8 +538,7 @@ dasd_kmalloc_request(char *magic, int cplength, int datasize,
539 if (datasize > 0) { 538 if (datasize > 0) {
540 cqr->data = kmalloc(datasize, GFP_ATOMIC | GFP_DMA); 539 cqr->data = kmalloc(datasize, GFP_ATOMIC | GFP_DMA);
541 if (cqr->data == NULL) { 540 if (cqr->data == NULL) {
542 if (cqr->cpaddr != NULL) 541 kfree(cqr->cpaddr);
543 kfree(cqr->cpaddr);
544 kfree(cqr); 542 kfree(cqr);
545 return ERR_PTR(-ENOMEM); 543 return ERR_PTR(-ENOMEM);
546 } 544 }
@@ -615,10 +613,8 @@ dasd_kfree_request(struct dasd_ccw_req * cqr, struct dasd_device * device)
615 clear_normalized_cda(ccw); 613 clear_normalized_cda(ccw);
616 } while (ccw++->flags & (CCW_FLAG_CC | CCW_FLAG_DC)); 614 } while (ccw++->flags & (CCW_FLAG_CC | CCW_FLAG_DC));
617#endif 615#endif
618 if (cqr->cpaddr != NULL) 616 kfree(cqr->cpaddr);
619 kfree(cqr->cpaddr); 617 kfree(cqr->data);
620 if (cqr->data != NULL)
621 kfree(cqr->data);
622 kfree(cqr); 618 kfree(cqr);
623 dasd_put_device(device); 619 dasd_put_device(device);
624} 620}
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index bda896d9d788..caee16a3dc62 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -387,8 +387,7 @@ dasd_add_busid(char *bus_id, int features)
387 new = 0; 387 new = 0;
388 } 388 }
389 spin_unlock(&dasd_devmap_lock); 389 spin_unlock(&dasd_devmap_lock);
390 if (new) 390 kfree(new);
391 kfree(new);
392 return devmap; 391 return devmap;
393} 392}
394 393
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index f11a67fda40e..75419cf9d353 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -727,8 +727,7 @@ raw3215_remove (struct ccw_device *cdev)
727 raw = cdev->dev.driver_data; 727 raw = cdev->dev.driver_data;
728 if (raw) { 728 if (raw) {
729 cdev->dev.driver_data = NULL; 729 cdev->dev.driver_data = NULL;
730 if (raw->buffer) 730 kfree(raw->buffer);
731 kfree(raw->buffer);
732 kfree(raw); 731 kfree(raw);
733 } 732 }
734} 733}
diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c
index fd43d99b45a3..5bda2340a39d 100644
--- a/drivers/s390/char/keyboard.c
+++ b/drivers/s390/char/keyboard.c
@@ -99,13 +99,11 @@ out_fn_handler:
99 kfree(kbd->fn_handler); 99 kfree(kbd->fn_handler);
100out_func: 100out_func:
101 for (i = 0; i < ARRAY_SIZE(func_table); i++) 101 for (i = 0; i < ARRAY_SIZE(func_table); i++)
102 if (kbd->func_table[i]) 102 kfree(kbd->func_table[i]);
103 kfree(kbd->func_table[i]);
104 kfree(kbd->func_table); 103 kfree(kbd->func_table);
105out_maps: 104out_maps:
106 for (i = 0; i < ARRAY_SIZE(key_maps); i++) 105 for (i = 0; i < ARRAY_SIZE(key_maps); i++)
107 if (kbd->key_maps[i]) 106 kfree(kbd->key_maps[i]);
108 kfree(kbd->key_maps[i]);
109 kfree(kbd->key_maps); 107 kfree(kbd->key_maps);
110out_kbd: 108out_kbd:
111 kfree(kbd); 109 kfree(kbd);
@@ -121,12 +119,10 @@ kbd_free(struct kbd_data *kbd)
121 kfree(kbd->accent_table); 119 kfree(kbd->accent_table);
122 kfree(kbd->fn_handler); 120 kfree(kbd->fn_handler);
123 for (i = 0; i < ARRAY_SIZE(func_table); i++) 121 for (i = 0; i < ARRAY_SIZE(func_table); i++)
124 if (kbd->func_table[i]) 122 kfree(kbd->func_table[i]);
125 kfree(kbd->func_table[i]);
126 kfree(kbd->func_table); 123 kfree(kbd->func_table);
127 for (i = 0; i < ARRAY_SIZE(key_maps); i++) 124 for (i = 0; i < ARRAY_SIZE(key_maps); i++)
128 if (kbd->key_maps[i]) 125 kfree(kbd->key_maps[i]);
129 kfree(kbd->key_maps[i]);
130 kfree(kbd->key_maps); 126 kfree(kbd->key_maps);
131 kfree(kbd); 127 kfree(kbd);
132} 128}
@@ -452,8 +448,7 @@ do_kdgkb_ioctl(struct kbd_data *kbd, struct kbsentry __user *u_kbs,
452 return -EFAULT; 448 return -EFAULT;
453 } 449 }
454 p[len] = 0; 450 p[len] = 0;
455 if (kbd->func_table[kb_func]) 451 kfree(kbd->func_table[kb_func]);
456 kfree(kbd->func_table[kb_func]);
457 kbd->func_table[kb_func] = p; 452 kbd->func_table[kb_func] = p;
458 break; 453 break;
459 } 454 }
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index d66946443dfc..f5b7d360fc10 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -183,8 +183,7 @@ raw3270_request_alloc_bootmem(size_t size)
183void 183void
184raw3270_request_free (struct raw3270_request *rq) 184raw3270_request_free (struct raw3270_request *rq)
185{ 185{
186 if (rq->buffer) 186 kfree(rq->buffer);
187 kfree(rq->buffer);
188 kfree(rq); 187 kfree(rq);
189} 188}
190 189
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index 6c52e8307dc5..8f486e1a8507 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -682,8 +682,7 @@ tape_alloc_request(int cplength, int datasize)
682 request->cpdata = kmalloc(datasize, GFP_KERNEL | GFP_DMA); 682 request->cpdata = kmalloc(datasize, GFP_KERNEL | GFP_DMA);
683 if (request->cpdata == NULL) { 683 if (request->cpdata == NULL) {
684 DBF_EXCEPTION(1, "cqra nomem\n"); 684 DBF_EXCEPTION(1, "cqra nomem\n");
685 if (request->cpaddr != NULL) 685 kfree(request->cpaddr);
686 kfree(request->cpaddr);
687 kfree(request); 686 kfree(request);
688 return ERR_PTR(-ENOMEM); 687 return ERR_PTR(-ENOMEM);
689 } 688 }
@@ -706,10 +705,8 @@ tape_free_request (struct tape_request * request)
706 if (request->device != NULL) { 705 if (request->device != NULL) {
707 request->device = tape_put_device(request->device); 706 request->device = tape_put_device(request->device);
708 } 707 }
709 if (request->cpdata != NULL) 708 kfree(request->cpdata);
710 kfree(request->cpdata); 709 kfree(request->cpaddr);
711 if (request->cpaddr != NULL)
712 kfree(request->cpaddr);
713 kfree(request); 710 kfree(request);
714} 711}
715 712
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index c05b069c2996..b978f7fe8327 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -642,8 +642,7 @@ static void
642free_cmbe (struct ccw_device *cdev) 642free_cmbe (struct ccw_device *cdev)
643{ 643{
644 spin_lock_irq(cdev->ccwlock); 644 spin_lock_irq(cdev->ccwlock);
645 if (cdev->private->cmb) 645 kfree(cdev->private->cmb);
646 kfree(cdev->private->cmb);
647 cdev->private->cmb = NULL; 646 cdev->private->cmb = NULL;
648 spin_unlock_irq(cdev->ccwlock); 647 spin_unlock_irq(cdev->ccwlock);
649 648
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c
index ad3fe5aeb663..85a3026e6900 100644
--- a/drivers/s390/cio/device_ops.c
+++ b/drivers/s390/cio/device_ops.c
@@ -550,10 +550,8 @@ ccw_device_stlck(struct ccw_device *cdev)
550 /* Clear irb. */ 550 /* Clear irb. */
551 memset(&cdev->private->irb, 0, sizeof(struct irb)); 551 memset(&cdev->private->irb, 0, sizeof(struct irb));
552out_unlock: 552out_unlock:
553 if (buf) 553 kfree(buf);
554 kfree(buf); 554 kfree(buf2);
555 if (buf2)
556 kfree(buf2);
557 spin_unlock_irqrestore(&sch->lock, flags); 555 spin_unlock_irqrestore(&sch->lock, flags);
558 return ret; 556 return ret;
559} 557}
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index ef5cd07011bb..eb39218b925e 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -1338,16 +1338,14 @@ qdio_release_irq_memory(struct qdio_irq *irq_ptr)
1338 if (!irq_ptr->input_qs[i]) 1338 if (!irq_ptr->input_qs[i])
1339 goto next; 1339 goto next;
1340 1340
1341 if (irq_ptr->input_qs[i]->slib) 1341 kfree(irq_ptr->input_qs[i]->slib);
1342 kfree(irq_ptr->input_qs[i]->slib);
1343 kfree(irq_ptr->input_qs[i]); 1342 kfree(irq_ptr->input_qs[i]);
1344 1343
1345next: 1344next:
1346 if (!irq_ptr->output_qs[i]) 1345 if (!irq_ptr->output_qs[i])
1347 continue; 1346 continue;
1348 1347
1349 if (irq_ptr->output_qs[i]->slib) 1348 kfree(irq_ptr->output_qs[i]->slib);
1350 kfree(irq_ptr->output_qs[i]->slib);
1351 kfree(irq_ptr->output_qs[i]); 1349 kfree(irq_ptr->output_qs[i]);
1352 1350
1353 } 1351 }
@@ -3315,8 +3313,7 @@ qdio_get_qdio_memory(void)
3315static void 3313static void
3316qdio_release_qdio_memory(void) 3314qdio_release_qdio_memory(void)
3317{ 3315{
3318 if (indicators) 3316 kfree(indicators);
3319 kfree(indicators);
3320} 3317}
3321 3318
3322static void 3319static void
diff --git a/drivers/s390/crypto/z90main.c b/drivers/s390/crypto/z90main.c
index 0cb47eca91f3..04c2ef778ec6 100644
--- a/drivers/s390/crypto/z90main.c
+++ b/drivers/s390/crypto/z90main.c
@@ -3051,8 +3051,7 @@ destroy_crypto_device(int index)
3051 if (dev_ptr) { 3051 if (dev_ptr) {
3052 disabledFlag = dev_ptr->disabled; 3052 disabledFlag = dev_ptr->disabled;
3053 t = dev_ptr->dev_type; 3053 t = dev_ptr->dev_type;
3054 if (dev_ptr->dev_resp_p) 3054 kfree(dev_ptr->dev_resp_p);
3055 kfree(dev_ptr->dev_resp_p);
3056 kfree(dev_ptr); 3055 kfree(dev_ptr);
3057 } else { 3056 } else {
3058 disabledFlag = 0; 3057 disabledFlag = 0;
@@ -3080,11 +3079,11 @@ static void
3080destroy_z90crypt(void) 3079destroy_z90crypt(void)
3081{ 3080{
3082 int i; 3081 int i;
3082
3083 for (i = 0; i < z90crypt.max_count; i++) 3083 for (i = 0; i < z90crypt.max_count; i++)
3084 if (z90crypt.device_p[i]) 3084 if (z90crypt.device_p[i])
3085 destroy_crypto_device(i); 3085 destroy_crypto_device(i);
3086 if (z90crypt.hdware_info) 3086 kfree(z90crypt.hdware_info);
3087 kfree((void *)z90crypt.hdware_info);
3088 memset((void *)&z90crypt, 0, sizeof(z90crypt)); 3087 memset((void *)&z90crypt, 0, sizeof(z90crypt));
3089} 3088}
3090 3089
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index 3092473991a7..1a1c3decea72 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -2743,14 +2743,10 @@ probe_error( struct ccwgroup_device *cgdev)
2743#endif 2743#endif
2744 privptr=(struct claw_privbk *)cgdev->dev.driver_data; 2744 privptr=(struct claw_privbk *)cgdev->dev.driver_data;
2745 if (privptr!=NULL) { 2745 if (privptr!=NULL) {
2746 if (privptr->p_env != NULL) { 2746 kfree(privptr->p_env);
2747 kfree(privptr->p_env); 2747 privptr->p_env=NULL;
2748 privptr->p_env=NULL; 2748 kfree(privptr->p_mtc_envelope);
2749 } 2749 privptr->p_mtc_envelope=NULL;
2750 if (privptr->p_mtc_envelope!=NULL) {
2751 kfree(privptr->p_mtc_envelope);
2752 privptr->p_mtc_envelope=NULL;
2753 }
2754 kfree(privptr); 2750 kfree(privptr);
2755 privptr=NULL; 2751 privptr=NULL;
2756 } 2752 }
@@ -4121,22 +4117,14 @@ claw_remove_device(struct ccwgroup_device *cgdev)
4121 if (cgdev->state == CCWGROUP_ONLINE) 4117 if (cgdev->state == CCWGROUP_ONLINE)
4122 claw_shutdown_device(cgdev); 4118 claw_shutdown_device(cgdev);
4123 claw_remove_files(&cgdev->dev); 4119 claw_remove_files(&cgdev->dev);
4124 if (priv->p_mtc_envelope!=NULL) { 4120 kfree(priv->p_mtc_envelope);
4125 kfree(priv->p_mtc_envelope); 4121 priv->p_mtc_envelope=NULL;
4126 priv->p_mtc_envelope=NULL; 4122 kfree(priv->p_env);
4127 } 4123 priv->p_env=NULL;
4128 if (priv->p_env != NULL) { 4124 kfree(priv->channel[0].irb);
4129 kfree(priv->p_env); 4125 priv->channel[0].irb=NULL;
4130 priv->p_env=NULL; 4126 kfree(priv->channel[1].irb);
4131 } 4127 priv->channel[1].irb=NULL;
4132 if (priv->channel[0].irb != NULL) {
4133 kfree(priv->channel[0].irb);
4134 priv->channel[0].irb=NULL;
4135 }
4136 if (priv->channel[1].irb != NULL) {
4137 kfree(priv->channel[1].irb);
4138 priv->channel[1].irb=NULL;
4139 }
4140 kfree(priv); 4128 kfree(priv);
4141 cgdev->dev.driver_data=NULL; 4129 cgdev->dev.driver_data=NULL;
4142 cgdev->cdev[READ]->dev.driver_data = NULL; 4130 cgdev->cdev[READ]->dev.driver_data = NULL;
diff --git a/drivers/s390/net/fsm.c b/drivers/s390/net/fsm.c
index 38f50b7129a2..24029bd9c7d0 100644
--- a/drivers/s390/net/fsm.c
+++ b/drivers/s390/net/fsm.c
@@ -78,8 +78,7 @@ kfree_fsm(fsm_instance *this)
78{ 78{
79 if (this) { 79 if (this) {
80 if (this->f) { 80 if (this->f) {
81 if (this->f->jumpmatrix) 81 kfree(this->f->jumpmatrix);
82 kfree(this->f->jumpmatrix);
83 kfree(this->f); 82 kfree(this->f);
84 } 83 }
85 kfree(this); 84 kfree(this);
diff --git a/drivers/s390/net/iucv.c b/drivers/s390/net/iucv.c
index e08e74e16124..df7647c3c100 100644
--- a/drivers/s390/net/iucv.c
+++ b/drivers/s390/net/iucv.c
@@ -447,14 +447,10 @@ static void
447iucv_exit(void) 447iucv_exit(void)
448{ 448{
449 iucv_retrieve_buffer(); 449 iucv_retrieve_buffer();
450 if (iucv_external_int_buffer) { 450 kfree(iucv_external_int_buffer);
451 kfree(iucv_external_int_buffer); 451 iucv_external_int_buffer = NULL;
452 iucv_external_int_buffer = NULL; 452 kfree(iucv_param_pool);
453 } 453 iucv_param_pool = NULL;
454 if (iucv_param_pool) {
455 kfree(iucv_param_pool);
456 iucv_param_pool = NULL;
457 }
458 s390_root_dev_unregister(iucv_root); 454 s390_root_dev_unregister(iucv_root);
459 bus_unregister(&iucv_bus); 455 bus_unregister(&iucv_bus);
460 printk(KERN_INFO "IUCV lowlevel driver unloaded\n"); 456 printk(KERN_INFO "IUCV lowlevel driver unloaded\n");
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 46f34ba93ac5..1c8ad2fcad8a 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -145,8 +145,7 @@ lcs_free_channel(struct lcs_channel *channel)
145 145
146 LCS_DBF_TEXT(2, setup, "ichfree"); 146 LCS_DBF_TEXT(2, setup, "ichfree");
147 for (cnt = 0; cnt < LCS_NUM_BUFFS; cnt++) { 147 for (cnt = 0; cnt < LCS_NUM_BUFFS; cnt++) {
148 if (channel->iob[cnt].data != NULL) 148 kfree(channel->iob[cnt].data);
149 kfree(channel->iob[cnt].data);
150 channel->iob[cnt].data = NULL; 149 channel->iob[cnt].data = NULL;
151 } 150 }
152} 151}
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c
index f94f1f25eec6..011915d5e243 100644
--- a/drivers/s390/net/qeth_eddp.c
+++ b/drivers/s390/net/qeth_eddp.c
@@ -62,8 +62,7 @@ qeth_eddp_free_context(struct qeth_eddp_context *ctx)
62 for (i = 0; i < ctx->num_pages; ++i) 62 for (i = 0; i < ctx->num_pages; ++i)
63 free_page((unsigned long)ctx->pages[i]); 63 free_page((unsigned long)ctx->pages[i]);
64 kfree(ctx->pages); 64 kfree(ctx->pages);
65 if (ctx->elements != NULL) 65 kfree(ctx->elements);
66 kfree(ctx->elements);
67 kfree(ctx); 66 kfree(ctx);
68} 67}
69 68
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index cab098556b44..c218b5c944a6 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -450,8 +450,7 @@ zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command,
450 kfree(sg_list); 450 kfree(sg_list);
451 } 451 }
452 452
453 if (sense_data != NULL) 453 kfree(sense_data);
454 kfree(sense_data);
455 454
456 return retval; 455 return retval;
457} 456}