aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ehca
diff options
context:
space:
mode:
authorRobert P. J. Day <rpjday@mindspring.com>2007-02-10 04:45:03 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:27 -0500
commitc376222960ae91d5ffb9197ee36771aaed1d9f90 (patch)
tree7f431c42529fec77433d33490bd9f2a8c47ba091 /drivers/infiniband/hw/ehca
parent1b135431abf5ea92e61bf4e91d93726c7b96da5f (diff)
[PATCH] Transform kmem_cache_alloc()+memset(0) -> kmem_cache_zalloc().
Replace appropriate pairs of "kmem_cache_alloc()" + "memset(0)" with the corresponding "kmem_cache_zalloc()" call. Signed-off-by: Robert P. J. Day <rpjday@mindspring.com> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Andi Kleen <ak@muc.de> Cc: Roland McGrath <roland@redhat.com> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: Greg KH <greg@kroah.com> Acked-by: Joel Becker <Joel.Becker@oracle.com> Cc: Steven Whitehouse <swhiteho@redhat.com> Cc: Jan Kara <jack@ucw.cz> Cc: Michael Halcrow <mhalcrow@us.ibm.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Stephen Smalley <sds@tycho.nsa.gov> Cc: James Morris <jmorris@namei.org> Cc: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/infiniband/hw/ehca')
-rw-r--r--drivers/infiniband/hw/ehca/ehca_cq.c3
-rw-r--r--drivers/infiniband/hw/ehca/ehca_mrmw.c6
-rw-r--r--drivers/infiniband/hw/ehca/ehca_pd.c3
-rw-r--r--drivers/infiniband/hw/ehca/ehca_qp.c3
4 files changed, 5 insertions, 10 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c
index 9291a86ca053..6ebfa27e4e16 100644
--- a/drivers/infiniband/hw/ehca/ehca_cq.c
+++ b/drivers/infiniband/hw/ehca/ehca_cq.c
@@ -134,14 +134,13 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe,
134 if (cqe >= 0xFFFFFFFF - 64 - additional_cqe) 134 if (cqe >= 0xFFFFFFFF - 64 - additional_cqe)
135 return ERR_PTR(-EINVAL); 135 return ERR_PTR(-EINVAL);
136 136
137 my_cq = kmem_cache_alloc(cq_cache, GFP_KERNEL); 137 my_cq = kmem_cache_zalloc(cq_cache, GFP_KERNEL);
138 if (!my_cq) { 138 if (!my_cq) {
139 ehca_err(device, "Out of memory for ehca_cq struct device=%p", 139 ehca_err(device, "Out of memory for ehca_cq struct device=%p",
140 device); 140 device);
141 return ERR_PTR(-ENOMEM); 141 return ERR_PTR(-ENOMEM);
142 } 142 }
143 143
144 memset(my_cq, 0, sizeof(struct ehca_cq));
145 memset(&param, 0, sizeof(struct ehca_alloc_cq_parms)); 144 memset(&param, 0, sizeof(struct ehca_alloc_cq_parms));
146 145
147 spin_lock_init(&my_cq->spinlock); 146 spin_lock_init(&my_cq->spinlock);
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index cfb362a1029c..d22ab563633f 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -53,9 +53,8 @@ static struct ehca_mr *ehca_mr_new(void)
53{ 53{
54 struct ehca_mr *me; 54 struct ehca_mr *me;
55 55
56 me = kmem_cache_alloc(mr_cache, GFP_KERNEL); 56 me = kmem_cache_zalloc(mr_cache, GFP_KERNEL);
57 if (me) { 57 if (me) {
58 memset(me, 0, sizeof(struct ehca_mr));
59 spin_lock_init(&me->mrlock); 58 spin_lock_init(&me->mrlock);
60 } else 59 } else
61 ehca_gen_err("alloc failed"); 60 ehca_gen_err("alloc failed");
@@ -72,9 +71,8 @@ static struct ehca_mw *ehca_mw_new(void)
72{ 71{
73 struct ehca_mw *me; 72 struct ehca_mw *me;
74 73
75 me = kmem_cache_alloc(mw_cache, GFP_KERNEL); 74 me = kmem_cache_zalloc(mw_cache, GFP_KERNEL);
76 if (me) { 75 if (me) {
77 memset(me, 0, sizeof(struct ehca_mw));
78 spin_lock_init(&me->mwlock); 76 spin_lock_init(&me->mwlock);
79 } else 77 } else
80 ehca_gen_err("alloc failed"); 78 ehca_gen_err("alloc failed");
diff --git a/drivers/infiniband/hw/ehca/ehca_pd.c b/drivers/infiniband/hw/ehca/ehca_pd.c
index d5345e5b3cd6..79d0591a8043 100644
--- a/drivers/infiniband/hw/ehca/ehca_pd.c
+++ b/drivers/infiniband/hw/ehca/ehca_pd.c
@@ -50,14 +50,13 @@ struct ib_pd *ehca_alloc_pd(struct ib_device *device,
50{ 50{
51 struct ehca_pd *pd; 51 struct ehca_pd *pd;
52 52
53 pd = kmem_cache_alloc(pd_cache, GFP_KERNEL); 53 pd = kmem_cache_zalloc(pd_cache, GFP_KERNEL);
54 if (!pd) { 54 if (!pd) {
55 ehca_err(device, "device=%p context=%p out of memory", 55 ehca_err(device, "device=%p context=%p out of memory",
56 device, context); 56 device, context);
57 return ERR_PTR(-ENOMEM); 57 return ERR_PTR(-ENOMEM);
58 } 58 }
59 59
60 memset(pd, 0, sizeof(struct ehca_pd));
61 pd->ownpid = current->tgid; 60 pd->ownpid = current->tgid;
62 61
63 /* 62 /*
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c
index 95efef921f1d..df0516f24379 100644
--- a/drivers/infiniband/hw/ehca/ehca_qp.c
+++ b/drivers/infiniband/hw/ehca/ehca_qp.c
@@ -450,13 +450,12 @@ struct ib_qp *ehca_create_qp(struct ib_pd *pd,
450 if (pd->uobject && udata) 450 if (pd->uobject && udata)
451 context = pd->uobject->context; 451 context = pd->uobject->context;
452 452
453 my_qp = kmem_cache_alloc(qp_cache, GFP_KERNEL); 453 my_qp = kmem_cache_zalloc(qp_cache, GFP_KERNEL);
454 if (!my_qp) { 454 if (!my_qp) {
455 ehca_err(pd->device, "pd=%p not enough memory to alloc qp", pd); 455 ehca_err(pd->device, "pd=%p not enough memory to alloc qp", pd);
456 return ERR_PTR(-ENOMEM); 456 return ERR_PTR(-ENOMEM);
457 } 457 }
458 458
459 memset(my_qp, 0, sizeof(struct ehca_qp));
460 memset (&parms, 0, sizeof(struct ehca_alloc_qp_parms)); 459 memset (&parms, 0, sizeof(struct ehca_alloc_qp_parms));
461 spin_lock_init(&my_qp->spinlock_s); 460 spin_lock_init(&my_qp->spinlock_s);
462 spin_lock_init(&my_qp->spinlock_r); 461 spin_lock_init(&my_qp->spinlock_r);