aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
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/macintosh
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/macintosh')
-rw-r--r--drivers/macintosh/macio_asic.c3
-rw-r--r--drivers/macintosh/smu.c3
-rw-r--r--drivers/macintosh/therm_pm72.c3
-rw-r--r--drivers/macintosh/therm_windtunnel.c3
-rw-r--r--drivers/macintosh/windfarm_lm75_sensor.c3
5 files changed, 5 insertions, 10 deletions
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index c96b7fe882a4..ec9e5f32f0ae 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -365,10 +365,9 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
365 if (np == NULL) 365 if (np == NULL)
366 return NULL; 366 return NULL;
367 367
368 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 368 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
369 if (!dev) 369 if (!dev)
370 return NULL; 370 return NULL;
371 memset(dev, 0, sizeof(*dev));
372 371
373 dev->bus = &chip->lbus; 372 dev->bus = &chip->lbus;
374 dev->media_bay = in_bay; 373 dev->media_bay = in_bay;
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index f8e1a135bf9d..d409f6759482 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -1053,10 +1053,9 @@ static int smu_open(struct inode *inode, struct file *file)
1053 struct smu_private *pp; 1053 struct smu_private *pp;
1054 unsigned long flags; 1054 unsigned long flags;
1055 1055
1056 pp = kmalloc(sizeof(struct smu_private), GFP_KERNEL); 1056 pp = kzalloc(sizeof(struct smu_private), GFP_KERNEL);
1057 if (pp == 0) 1057 if (pp == 0)
1058 return -ENOMEM; 1058 return -ENOMEM;
1059 memset(pp, 0, sizeof(struct smu_private));
1060 spin_lock_init(&pp->lock); 1059 spin_lock_init(&pp->lock);
1061 pp->mode = smu_file_commands; 1060 pp->mode = smu_file_commands;
1062 init_waitqueue_head(&pp->wait); 1061 init_waitqueue_head(&pp->wait);
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index 3d90fc002097..e43554e754a4 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -318,10 +318,9 @@ static struct i2c_client *attach_i2c_chip(int id, const char *name)
318 if (adap == NULL) 318 if (adap == NULL)
319 return NULL; 319 return NULL;
320 320
321 clt = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 321 clt = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
322 if (clt == NULL) 322 if (clt == NULL)
323 return NULL; 323 return NULL;
324 memset(clt, 0, sizeof(struct i2c_client));
325 324
326 clt->addr = (id >> 1) & 0x7f; 325 clt->addr = (id >> 1) & 0x7f;
327 clt->adapter = adap; 326 clt->adapter = adap;
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index 3d0354e96a97..5452da1bb1a5 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -431,9 +431,8 @@ do_probe( struct i2c_adapter *adapter, int addr, int kind )
431 | I2C_FUNC_SMBUS_WRITE_BYTE) ) 431 | I2C_FUNC_SMBUS_WRITE_BYTE) )
432 return 0; 432 return 0;
433 433
434 if( !(cl=kmalloc(sizeof(*cl), GFP_KERNEL)) ) 434 if( !(cl=kzalloc(sizeof(*cl), GFP_KERNEL)) )
435 return -ENOMEM; 435 return -ENOMEM;
436 memset( cl, 0, sizeof(struct i2c_client) );
437 436
438 cl->addr = addr; 437 cl->addr = addr;
439 cl->adapter = adapter; 438 cl->adapter = adapter;
diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c
index a0fabf3c2008..7e10c3ab4d50 100644
--- a/drivers/macintosh/windfarm_lm75_sensor.c
+++ b/drivers/macintosh/windfarm_lm75_sensor.c
@@ -117,10 +117,9 @@ static struct wf_lm75_sensor *wf_lm75_create(struct i2c_adapter *adapter,
117 DBG("wf_lm75: creating %s device at address 0x%02x\n", 117 DBG("wf_lm75: creating %s device at address 0x%02x\n",
118 ds1775 ? "ds1775" : "lm75", addr); 118 ds1775 ? "ds1775" : "lm75", addr);
119 119
120 lm = kmalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL); 120 lm = kzalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL);
121 if (lm == NULL) 121 if (lm == NULL)
122 return NULL; 122 return NULL;
123 memset(lm, 0, sizeof(struct wf_lm75_sensor));
124 123
125 /* Usual rant about sensor names not beeing very consistent in 124 /* Usual rant about sensor names not beeing very consistent in
126 * the device-tree, oh well ... 125 * the device-tree, oh well ...