mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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) [[email protected]: get kcalloc args the right way around] Signed-off-by: Yoann Padioleau <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Acked-by: Russell King <[email protected]> Cc: Bryan Wu <[email protected]> Acked-by: Jiri Slaby <[email protected]> Cc: Dave Airlie <[email protected]> Acked-by: Roland Dreier <[email protected]> Cc: Jiri Kosina <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Acked-by: Mauro Carvalho Chehab <[email protected]> Acked-by: Pierre Ossman <[email protected]> Cc: Jeff Garzik <[email protected]> Cc: "David S. Miller" <[email protected]> Acked-by: Greg KH <[email protected]> Cc: James Bottomley <[email protected]> Cc: "Antonino A. Daplas" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
3b5ad0797c
commit
dd00cc486a
136 changed files with 157 additions and 330 deletions
|
|
@ -365,10 +365,9 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
|
|||
if (np == NULL)
|
||||
return NULL;
|
||||
|
||||
dev = kmalloc(sizeof(*dev), GFP_KERNEL);
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
if (!dev)
|
||||
return NULL;
|
||||
memset(dev, 0, sizeof(*dev));
|
||||
|
||||
dev->bus = &chip->lbus;
|
||||
dev->media_bay = in_bay;
|
||||
|
|
|
|||
|
|
@ -1053,10 +1053,9 @@ static int smu_open(struct inode *inode, struct file *file)
|
|||
struct smu_private *pp;
|
||||
unsigned long flags;
|
||||
|
||||
pp = kmalloc(sizeof(struct smu_private), GFP_KERNEL);
|
||||
pp = kzalloc(sizeof(struct smu_private), GFP_KERNEL);
|
||||
if (pp == 0)
|
||||
return -ENOMEM;
|
||||
memset(pp, 0, sizeof(struct smu_private));
|
||||
spin_lock_init(&pp->lock);
|
||||
pp->mode = smu_file_commands;
|
||||
init_waitqueue_head(&pp->wait);
|
||||
|
|
|
|||
|
|
@ -318,10 +318,9 @@ static struct i2c_client *attach_i2c_chip(int id, const char *name)
|
|||
if (adap == NULL)
|
||||
return NULL;
|
||||
|
||||
clt = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
|
||||
clt = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
|
||||
if (clt == NULL)
|
||||
return NULL;
|
||||
memset(clt, 0, sizeof(struct i2c_client));
|
||||
|
||||
clt->addr = (id >> 1) & 0x7f;
|
||||
clt->adapter = adap;
|
||||
|
|
|
|||
|
|
@ -431,9 +431,8 @@ do_probe( struct i2c_adapter *adapter, int addr, int kind )
|
|||
| I2C_FUNC_SMBUS_WRITE_BYTE) )
|
||||
return 0;
|
||||
|
||||
if( !(cl=kmalloc(sizeof(*cl), GFP_KERNEL)) )
|
||||
if( !(cl=kzalloc(sizeof(*cl), GFP_KERNEL)) )
|
||||
return -ENOMEM;
|
||||
memset( cl, 0, sizeof(struct i2c_client) );
|
||||
|
||||
cl->addr = addr;
|
||||
cl->adapter = adapter;
|
||||
|
|
|
|||
|
|
@ -117,10 +117,9 @@ static struct wf_lm75_sensor *wf_lm75_create(struct i2c_adapter *adapter,
|
|||
DBG("wf_lm75: creating %s device at address 0x%02x\n",
|
||||
ds1775 ? "ds1775" : "lm75", addr);
|
||||
|
||||
lm = kmalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL);
|
||||
lm = kzalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL);
|
||||
if (lm == NULL)
|
||||
return NULL;
|
||||
memset(lm, 0, sizeof(struct wf_lm75_sensor));
|
||||
|
||||
/* Usual rant about sensor names not beeing very consistent in
|
||||
* the device-tree, oh well ...
|
||||
|
|
|
|||
Loading…
Reference in a new issue