mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -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
|
|
@ -295,10 +295,9 @@ int rdma_resolve_ip(struct rdma_addr_client *client,
|
|||
struct addr_req *req;
|
||||
int ret = 0;
|
||||
|
||||
req = kmalloc(sizeof *req, GFP_KERNEL);
|
||||
req = kzalloc(sizeof *req, GFP_KERNEL);
|
||||
if (!req)
|
||||
return -ENOMEM;
|
||||
memset(req, 0, sizeof *req);
|
||||
|
||||
if (src_addr)
|
||||
memcpy(&req->src_addr, src_addr, ip_addr_size(src_addr));
|
||||
|
|
|
|||
|
|
@ -229,9 +229,8 @@ static void *alloc_ep(int size, gfp_t gfp)
|
|||
{
|
||||
struct iwch_ep_common *epc;
|
||||
|
||||
epc = kmalloc(size, gfp);
|
||||
epc = kzalloc(size, gfp);
|
||||
if (epc) {
|
||||
memset(epc, 0, size);
|
||||
kref_init(&epc->kref);
|
||||
spin_lock_init(&epc->lock);
|
||||
init_waitqueue_head(&epc->waitq);
|
||||
|
|
|
|||
Loading…
Reference in a new issue