aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorYoann Padioleau <padator@wanadoo.fr>2007-07-19 04:49:03 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:50 -0400
commitdd00cc486ab1c17049a535413d1751ef3482141c (patch)
treed90ff69ea06792b9284f2f2665c96624f121b88a /drivers/s390
parent3b5ad0797c0e4049001f961a8b58f1d0ce532072 (diff)
some kmalloc/memset ->kzalloc (tree wide)
Transform some calls to kmalloc/memset to a single kzalloc (or kcalloc). Here is a short excerpt of the semantic patch performing this transformation: @@ type T2; expression x; identifier f,fld; expression E; expression E1,E2; expression e1,e2,e3,y; statement S; @@ x = - kmalloc + kzalloc (E1,E2) ... when != \(x->fld=E;\|y=f(...,x,...);\|f(...,x,...);\|x=E;\|while(...) S\|for(e1;e2;e3) S\) - memset((T2)x,0,E1); @@ expression E1,E2,E3; @@ - kzalloc(E1 * E2,E3) + kcalloc(E1,E2,E3) [akpm@linux-foundation.org: get kcalloc args the right way around] Signed-off-by: Yoann Padioleau <padator@wanadoo.fr> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Acked-by: Russell King <rmk@arm.linux.org.uk> Cc: Bryan Wu <bryan.wu@analog.com> Acked-by: Jiri Slaby <jirislaby@gmail.com> Cc: Dave Airlie <airlied@linux.ie> Acked-by: Roland Dreier <rolandd@cisco.com> Cc: Jiri Kosina <jkosina@suse.cz> Acked-by: Dmitry Torokhov <dtor@mail.ru> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org> Acked-by: Pierre Ossman <drzeus-list@drzeus.cx> Cc: Jeff Garzik <jeff@garzik.org> Cc: "David S. Miller" <davem@davemloft.net> Acked-by: Greg KH <greg@kroah.com> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/char/tape_34xx.c3
-rw-r--r--drivers/s390/net/claw.c9
2 files changed, 4 insertions, 8 deletions
diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c
index e765875e8db2..80e7a537e7d2 100644
--- a/drivers/s390/char/tape_34xx.c
+++ b/drivers/s390/char/tape_34xx.c
@@ -131,10 +131,9 @@ tape_34xx_schedule_work(struct tape_device *device, enum tape_op op)
131{ 131{
132 struct tape_34xx_work *p; 132 struct tape_34xx_work *p;
133 133
134 if ((p = kmalloc(sizeof(*p), GFP_ATOMIC)) == NULL) 134 if ((p = kzalloc(sizeof(*p), GFP_ATOMIC)) == NULL)
135 return -ENOMEM; 135 return -ENOMEM;
136 136
137 memset(p, 0, sizeof(*p));
138 INIT_WORK(&p->work, tape_34xx_work_handler); 137 INIT_WORK(&p->work, tape_34xx_work_handler);
139 138
140 p->device = tape_get_device_reference(device); 139 p->device = tape_get_device_reference(device);
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index 348bb7b82771..023455a0b34a 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -317,8 +317,8 @@ claw_probe(struct ccwgroup_device *cgdev)
317 CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); 317 CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM);
318 return -ENOMEM; 318 return -ENOMEM;
319 } 319 }
320 privptr->p_mtc_envelope= kmalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); 320 privptr->p_mtc_envelope= kzalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL);
321 privptr->p_env = kmalloc(sizeof(struct claw_env), GFP_KERNEL); 321 privptr->p_env = kzalloc(sizeof(struct claw_env), GFP_KERNEL);
322 if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) { 322 if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) {
323 probe_error(cgdev); 323 probe_error(cgdev);
324 put_device(&cgdev->dev); 324 put_device(&cgdev->dev);
@@ -327,8 +327,6 @@ claw_probe(struct ccwgroup_device *cgdev)
327 CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); 327 CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM);
328 return -ENOMEM; 328 return -ENOMEM;
329 } 329 }
330 memset(privptr->p_mtc_envelope, 0x00, MAX_ENVELOPE_SIZE);
331 memset(privptr->p_env, 0x00, sizeof(struct claw_env));
332 memcpy(privptr->p_env->adapter_name,WS_NAME_NOT_DEF,8); 330 memcpy(privptr->p_env->adapter_name,WS_NAME_NOT_DEF,8);
333 memcpy(privptr->p_env->host_name,WS_NAME_NOT_DEF,8); 331 memcpy(privptr->p_env->host_name,WS_NAME_NOT_DEF,8);
334 memcpy(privptr->p_env->api_type,WS_NAME_NOT_DEF,8); 332 memcpy(privptr->p_env->api_type,WS_NAME_NOT_DEF,8);
@@ -3924,7 +3922,7 @@ add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr)
3924 snprintf(p_ch->id, CLAW_ID_SIZE, "cl-%s", cdev->dev.bus_id); 3922 snprintf(p_ch->id, CLAW_ID_SIZE, "cl-%s", cdev->dev.bus_id);
3925 ccw_device_get_id(cdev, &dev_id); 3923 ccw_device_get_id(cdev, &dev_id);
3926 p_ch->devno = dev_id.devno; 3924 p_ch->devno = dev_id.devno;
3927 if ((p_ch->irb = kmalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) { 3925 if ((p_ch->irb = kzalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) {
3928 printk(KERN_WARNING "%s Out of memory in %s for irb\n", 3926 printk(KERN_WARNING "%s Out of memory in %s for irb\n",
3929 p_ch->id,__FUNCTION__); 3927 p_ch->id,__FUNCTION__);
3930#ifdef FUNCTRACE 3928#ifdef FUNCTRACE
@@ -3933,7 +3931,6 @@ add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr)
3933#endif 3931#endif
3934 return -ENOMEM; 3932 return -ENOMEM;
3935 } 3933 }
3936 memset(p_ch->irb, 0, sizeof (struct irb));
3937#ifdef FUNCTRACE 3934#ifdef FUNCTRACE
3938 printk(KERN_INFO "%s:%s Exit on line %d\n", 3935 printk(KERN_INFO "%s:%s Exit on line %d\n",
3939 cdev->dev.bus_id,__FUNCTION__,__LINE__); 3936 cdev->dev.bus_id,__FUNCTION__,__LINE__);