[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>
This commit is contained in:
parent
3c7208f253
commit
17fd682e54
@ -115,8 +115,7 @@ dasd_alloc_device(void)
|
|||||||
void
|
void
|
||||||
dasd_free_device(struct dasd_device *device)
|
dasd_free_device(struct dasd_device *device)
|
||||||
{
|
{
|
||||||
if (device->private)
|
kfree(device->private);
|
||||||
kfree(device->private);
|
|
||||||
free_page((unsigned long) device->erp_mem);
|
free_page((unsigned long) device->erp_mem);
|
||||||
free_pages((unsigned long) device->ccw_mem, 1);
|
free_pages((unsigned long) device->ccw_mem, 1);
|
||||||
kfree(device);
|
kfree(device);
|
||||||
@ -539,8 +538,7 @@ dasd_kmalloc_request(char *magic, int cplength, int datasize,
|
|||||||
if (datasize > 0) {
|
if (datasize > 0) {
|
||||||
cqr->data = kmalloc(datasize, GFP_ATOMIC | GFP_DMA);
|
cqr->data = kmalloc(datasize, GFP_ATOMIC | GFP_DMA);
|
||||||
if (cqr->data == NULL) {
|
if (cqr->data == NULL) {
|
||||||
if (cqr->cpaddr != NULL)
|
kfree(cqr->cpaddr);
|
||||||
kfree(cqr->cpaddr);
|
|
||||||
kfree(cqr);
|
kfree(cqr);
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
}
|
}
|
||||||
@ -615,10 +613,8 @@ dasd_kfree_request(struct dasd_ccw_req * cqr, struct dasd_device * device)
|
|||||||
clear_normalized_cda(ccw);
|
clear_normalized_cda(ccw);
|
||||||
} while (ccw++->flags & (CCW_FLAG_CC | CCW_FLAG_DC));
|
} while (ccw++->flags & (CCW_FLAG_CC | CCW_FLAG_DC));
|
||||||
#endif
|
#endif
|
||||||
if (cqr->cpaddr != NULL)
|
kfree(cqr->cpaddr);
|
||||||
kfree(cqr->cpaddr);
|
kfree(cqr->data);
|
||||||
if (cqr->data != NULL)
|
|
||||||
kfree(cqr->data);
|
|
||||||
kfree(cqr);
|
kfree(cqr);
|
||||||
dasd_put_device(device);
|
dasd_put_device(device);
|
||||||
}
|
}
|
||||||
|
@ -387,8 +387,7 @@ dasd_add_busid(char *bus_id, int features)
|
|||||||
new = 0;
|
new = 0;
|
||||||
}
|
}
|
||||||
spin_unlock(&dasd_devmap_lock);
|
spin_unlock(&dasd_devmap_lock);
|
||||||
if (new)
|
kfree(new);
|
||||||
kfree(new);
|
|
||||||
return devmap;
|
return devmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,8 +727,7 @@ raw3215_remove (struct ccw_device *cdev)
|
|||||||
raw = cdev->dev.driver_data;
|
raw = cdev->dev.driver_data;
|
||||||
if (raw) {
|
if (raw) {
|
||||||
cdev->dev.driver_data = NULL;
|
cdev->dev.driver_data = NULL;
|
||||||
if (raw->buffer)
|
kfree(raw->buffer);
|
||||||
kfree(raw->buffer);
|
|
||||||
kfree(raw);
|
kfree(raw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,13 +99,11 @@ out_fn_handler:
|
|||||||
kfree(kbd->fn_handler);
|
kfree(kbd->fn_handler);
|
||||||
out_func:
|
out_func:
|
||||||
for (i = 0; i < ARRAY_SIZE(func_table); i++)
|
for (i = 0; i < ARRAY_SIZE(func_table); i++)
|
||||||
if (kbd->func_table[i])
|
kfree(kbd->func_table[i]);
|
||||||
kfree(kbd->func_table[i]);
|
|
||||||
kfree(kbd->func_table);
|
kfree(kbd->func_table);
|
||||||
out_maps:
|
out_maps:
|
||||||
for (i = 0; i < ARRAY_SIZE(key_maps); i++)
|
for (i = 0; i < ARRAY_SIZE(key_maps); i++)
|
||||||
if (kbd->key_maps[i])
|
kfree(kbd->key_maps[i]);
|
||||||
kfree(kbd->key_maps[i]);
|
|
||||||
kfree(kbd->key_maps);
|
kfree(kbd->key_maps);
|
||||||
out_kbd:
|
out_kbd:
|
||||||
kfree(kbd);
|
kfree(kbd);
|
||||||
@ -121,12 +119,10 @@ kbd_free(struct kbd_data *kbd)
|
|||||||
kfree(kbd->accent_table);
|
kfree(kbd->accent_table);
|
||||||
kfree(kbd->fn_handler);
|
kfree(kbd->fn_handler);
|
||||||
for (i = 0; i < ARRAY_SIZE(func_table); i++)
|
for (i = 0; i < ARRAY_SIZE(func_table); i++)
|
||||||
if (kbd->func_table[i])
|
kfree(kbd->func_table[i]);
|
||||||
kfree(kbd->func_table[i]);
|
|
||||||
kfree(kbd->func_table);
|
kfree(kbd->func_table);
|
||||||
for (i = 0; i < ARRAY_SIZE(key_maps); i++)
|
for (i = 0; i < ARRAY_SIZE(key_maps); i++)
|
||||||
if (kbd->key_maps[i])
|
kfree(kbd->key_maps[i]);
|
||||||
kfree(kbd->key_maps[i]);
|
|
||||||
kfree(kbd->key_maps);
|
kfree(kbd->key_maps);
|
||||||
kfree(kbd);
|
kfree(kbd);
|
||||||
}
|
}
|
||||||
@ -452,8 +448,7 @@ do_kdgkb_ioctl(struct kbd_data *kbd, struct kbsentry __user *u_kbs,
|
|||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
p[len] = 0;
|
p[len] = 0;
|
||||||
if (kbd->func_table[kb_func])
|
kfree(kbd->func_table[kb_func]);
|
||||||
kfree(kbd->func_table[kb_func]);
|
|
||||||
kbd->func_table[kb_func] = p;
|
kbd->func_table[kb_func] = p;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -183,8 +183,7 @@ raw3270_request_alloc_bootmem(size_t size)
|
|||||||
void
|
void
|
||||||
raw3270_request_free (struct raw3270_request *rq)
|
raw3270_request_free (struct raw3270_request *rq)
|
||||||
{
|
{
|
||||||
if (rq->buffer)
|
kfree(rq->buffer);
|
||||||
kfree(rq->buffer);
|
|
||||||
kfree(rq);
|
kfree(rq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,8 +682,7 @@ tape_alloc_request(int cplength, int datasize)
|
|||||||
request->cpdata = kmalloc(datasize, GFP_KERNEL | GFP_DMA);
|
request->cpdata = kmalloc(datasize, GFP_KERNEL | GFP_DMA);
|
||||||
if (request->cpdata == NULL) {
|
if (request->cpdata == NULL) {
|
||||||
DBF_EXCEPTION(1, "cqra nomem\n");
|
DBF_EXCEPTION(1, "cqra nomem\n");
|
||||||
if (request->cpaddr != NULL)
|
kfree(request->cpaddr);
|
||||||
kfree(request->cpaddr);
|
|
||||||
kfree(request);
|
kfree(request);
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
}
|
}
|
||||||
@ -706,10 +705,8 @@ tape_free_request (struct tape_request * request)
|
|||||||
if (request->device != NULL) {
|
if (request->device != NULL) {
|
||||||
request->device = tape_put_device(request->device);
|
request->device = tape_put_device(request->device);
|
||||||
}
|
}
|
||||||
if (request->cpdata != NULL)
|
kfree(request->cpdata);
|
||||||
kfree(request->cpdata);
|
kfree(request->cpaddr);
|
||||||
if (request->cpaddr != NULL)
|
|
||||||
kfree(request->cpaddr);
|
|
||||||
kfree(request);
|
kfree(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,8 +642,7 @@ static void
|
|||||||
free_cmbe (struct ccw_device *cdev)
|
free_cmbe (struct ccw_device *cdev)
|
||||||
{
|
{
|
||||||
spin_lock_irq(cdev->ccwlock);
|
spin_lock_irq(cdev->ccwlock);
|
||||||
if (cdev->private->cmb)
|
kfree(cdev->private->cmb);
|
||||||
kfree(cdev->private->cmb);
|
|
||||||
cdev->private->cmb = NULL;
|
cdev->private->cmb = NULL;
|
||||||
spin_unlock_irq(cdev->ccwlock);
|
spin_unlock_irq(cdev->ccwlock);
|
||||||
|
|
||||||
|
@ -550,10 +550,8 @@ ccw_device_stlck(struct ccw_device *cdev)
|
|||||||
/* Clear irb. */
|
/* Clear irb. */
|
||||||
memset(&cdev->private->irb, 0, sizeof(struct irb));
|
memset(&cdev->private->irb, 0, sizeof(struct irb));
|
||||||
out_unlock:
|
out_unlock:
|
||||||
if (buf)
|
kfree(buf);
|
||||||
kfree(buf);
|
kfree(buf2);
|
||||||
if (buf2)
|
|
||||||
kfree(buf2);
|
|
||||||
spin_unlock_irqrestore(&sch->lock, flags);
|
spin_unlock_irqrestore(&sch->lock, flags);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1338,16 +1338,14 @@ qdio_release_irq_memory(struct qdio_irq *irq_ptr)
|
|||||||
if (!irq_ptr->input_qs[i])
|
if (!irq_ptr->input_qs[i])
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
if (irq_ptr->input_qs[i]->slib)
|
kfree(irq_ptr->input_qs[i]->slib);
|
||||||
kfree(irq_ptr->input_qs[i]->slib);
|
|
||||||
kfree(irq_ptr->input_qs[i]);
|
kfree(irq_ptr->input_qs[i]);
|
||||||
|
|
||||||
next:
|
next:
|
||||||
if (!irq_ptr->output_qs[i])
|
if (!irq_ptr->output_qs[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (irq_ptr->output_qs[i]->slib)
|
kfree(irq_ptr->output_qs[i]->slib);
|
||||||
kfree(irq_ptr->output_qs[i]->slib);
|
|
||||||
kfree(irq_ptr->output_qs[i]);
|
kfree(irq_ptr->output_qs[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3315,8 +3313,7 @@ qdio_get_qdio_memory(void)
|
|||||||
static void
|
static void
|
||||||
qdio_release_qdio_memory(void)
|
qdio_release_qdio_memory(void)
|
||||||
{
|
{
|
||||||
if (indicators)
|
kfree(indicators);
|
||||||
kfree(indicators);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -3051,8 +3051,7 @@ destroy_crypto_device(int index)
|
|||||||
if (dev_ptr) {
|
if (dev_ptr) {
|
||||||
disabledFlag = dev_ptr->disabled;
|
disabledFlag = dev_ptr->disabled;
|
||||||
t = dev_ptr->dev_type;
|
t = dev_ptr->dev_type;
|
||||||
if (dev_ptr->dev_resp_p)
|
kfree(dev_ptr->dev_resp_p);
|
||||||
kfree(dev_ptr->dev_resp_p);
|
|
||||||
kfree(dev_ptr);
|
kfree(dev_ptr);
|
||||||
} else {
|
} else {
|
||||||
disabledFlag = 0;
|
disabledFlag = 0;
|
||||||
@ -3080,11 +3079,11 @@ static void
|
|||||||
destroy_z90crypt(void)
|
destroy_z90crypt(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < z90crypt.max_count; i++)
|
for (i = 0; i < z90crypt.max_count; i++)
|
||||||
if (z90crypt.device_p[i])
|
if (z90crypt.device_p[i])
|
||||||
destroy_crypto_device(i);
|
destroy_crypto_device(i);
|
||||||
if (z90crypt.hdware_info)
|
kfree(z90crypt.hdware_info);
|
||||||
kfree((void *)z90crypt.hdware_info);
|
|
||||||
memset((void *)&z90crypt, 0, sizeof(z90crypt));
|
memset((void *)&z90crypt, 0, sizeof(z90crypt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2743,14 +2743,10 @@ probe_error( struct ccwgroup_device *cgdev)
|
|||||||
#endif
|
#endif
|
||||||
privptr=(struct claw_privbk *)cgdev->dev.driver_data;
|
privptr=(struct claw_privbk *)cgdev->dev.driver_data;
|
||||||
if (privptr!=NULL) {
|
if (privptr!=NULL) {
|
||||||
if (privptr->p_env != NULL) {
|
kfree(privptr->p_env);
|
||||||
kfree(privptr->p_env);
|
privptr->p_env=NULL;
|
||||||
privptr->p_env=NULL;
|
kfree(privptr->p_mtc_envelope);
|
||||||
}
|
privptr->p_mtc_envelope=NULL;
|
||||||
if (privptr->p_mtc_envelope!=NULL) {
|
|
||||||
kfree(privptr->p_mtc_envelope);
|
|
||||||
privptr->p_mtc_envelope=NULL;
|
|
||||||
}
|
|
||||||
kfree(privptr);
|
kfree(privptr);
|
||||||
privptr=NULL;
|
privptr=NULL;
|
||||||
}
|
}
|
||||||
@ -4121,22 +4117,14 @@ claw_remove_device(struct ccwgroup_device *cgdev)
|
|||||||
if (cgdev->state == CCWGROUP_ONLINE)
|
if (cgdev->state == CCWGROUP_ONLINE)
|
||||||
claw_shutdown_device(cgdev);
|
claw_shutdown_device(cgdev);
|
||||||
claw_remove_files(&cgdev->dev);
|
claw_remove_files(&cgdev->dev);
|
||||||
if (priv->p_mtc_envelope!=NULL) {
|
kfree(priv->p_mtc_envelope);
|
||||||
kfree(priv->p_mtc_envelope);
|
priv->p_mtc_envelope=NULL;
|
||||||
priv->p_mtc_envelope=NULL;
|
kfree(priv->p_env);
|
||||||
}
|
priv->p_env=NULL;
|
||||||
if (priv->p_env != NULL) {
|
kfree(priv->channel[0].irb);
|
||||||
kfree(priv->p_env);
|
priv->channel[0].irb=NULL;
|
||||||
priv->p_env=NULL;
|
kfree(priv->channel[1].irb);
|
||||||
}
|
priv->channel[1].irb=NULL;
|
||||||
if (priv->channel[0].irb != NULL) {
|
|
||||||
kfree(priv->channel[0].irb);
|
|
||||||
priv->channel[0].irb=NULL;
|
|
||||||
}
|
|
||||||
if (priv->channel[1].irb != NULL) {
|
|
||||||
kfree(priv->channel[1].irb);
|
|
||||||
priv->channel[1].irb=NULL;
|
|
||||||
}
|
|
||||||
kfree(priv);
|
kfree(priv);
|
||||||
cgdev->dev.driver_data=NULL;
|
cgdev->dev.driver_data=NULL;
|
||||||
cgdev->cdev[READ]->dev.driver_data = NULL;
|
cgdev->cdev[READ]->dev.driver_data = NULL;
|
||||||
|
@ -78,8 +78,7 @@ kfree_fsm(fsm_instance *this)
|
|||||||
{
|
{
|
||||||
if (this) {
|
if (this) {
|
||||||
if (this->f) {
|
if (this->f) {
|
||||||
if (this->f->jumpmatrix)
|
kfree(this->f->jumpmatrix);
|
||||||
kfree(this->f->jumpmatrix);
|
|
||||||
kfree(this->f);
|
kfree(this->f);
|
||||||
}
|
}
|
||||||
kfree(this);
|
kfree(this);
|
||||||
|
@ -447,14 +447,10 @@ static void
|
|||||||
iucv_exit(void)
|
iucv_exit(void)
|
||||||
{
|
{
|
||||||
iucv_retrieve_buffer();
|
iucv_retrieve_buffer();
|
||||||
if (iucv_external_int_buffer) {
|
kfree(iucv_external_int_buffer);
|
||||||
kfree(iucv_external_int_buffer);
|
iucv_external_int_buffer = NULL;
|
||||||
iucv_external_int_buffer = NULL;
|
kfree(iucv_param_pool);
|
||||||
}
|
iucv_param_pool = NULL;
|
||||||
if (iucv_param_pool) {
|
|
||||||
kfree(iucv_param_pool);
|
|
||||||
iucv_param_pool = NULL;
|
|
||||||
}
|
|
||||||
s390_root_dev_unregister(iucv_root);
|
s390_root_dev_unregister(iucv_root);
|
||||||
bus_unregister(&iucv_bus);
|
bus_unregister(&iucv_bus);
|
||||||
printk(KERN_INFO "IUCV lowlevel driver unloaded\n");
|
printk(KERN_INFO "IUCV lowlevel driver unloaded\n");
|
||||||
|
@ -145,8 +145,7 @@ lcs_free_channel(struct lcs_channel *channel)
|
|||||||
|
|
||||||
LCS_DBF_TEXT(2, setup, "ichfree");
|
LCS_DBF_TEXT(2, setup, "ichfree");
|
||||||
for (cnt = 0; cnt < LCS_NUM_BUFFS; cnt++) {
|
for (cnt = 0; cnt < LCS_NUM_BUFFS; cnt++) {
|
||||||
if (channel->iob[cnt].data != NULL)
|
kfree(channel->iob[cnt].data);
|
||||||
kfree(channel->iob[cnt].data);
|
|
||||||
channel->iob[cnt].data = NULL;
|
channel->iob[cnt].data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,7 @@ qeth_eddp_free_context(struct qeth_eddp_context *ctx)
|
|||||||
for (i = 0; i < ctx->num_pages; ++i)
|
for (i = 0; i < ctx->num_pages; ++i)
|
||||||
free_page((unsigned long)ctx->pages[i]);
|
free_page((unsigned long)ctx->pages[i]);
|
||||||
kfree(ctx->pages);
|
kfree(ctx->pages);
|
||||||
if (ctx->elements != NULL)
|
kfree(ctx->elements);
|
||||||
kfree(ctx->elements);
|
|
||||||
kfree(ctx);
|
kfree(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,8 +450,7 @@ zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command,
|
|||||||
kfree(sg_list);
|
kfree(sg_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sense_data != NULL)
|
kfree(sense_data);
|
||||||
kfree(sense_data);
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user