diff options
author | Robert P. J. Day <rpjday@mindspring.com> | 2007-02-10 04:45:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 13:51:27 -0500 |
commit | c376222960ae91d5ffb9197ee36771aaed1d9f90 (patch) | |
tree | 7f431c42529fec77433d33490bd9f2a8c47ba091 /drivers | |
parent | 1b135431abf5ea92e61bf4e91d93726c7b96da5f (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')
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_cq.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_mrmw.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_pd.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_qp.c | 3 | ||||
-rw-r--r-- | drivers/scsi/aic94xx/aic94xx_hwi.c | 3 | ||||
-rw-r--r-- | drivers/scsi/scsi_lib.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/hc_crisv10.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/uhci-q.c | 4 |
8 files changed, 9 insertions, 19 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(¶m, 0, sizeof(struct ehca_alloc_cq_parms)); | 144 | memset(¶m, 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); |
diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c index da94e126ca83..0cd7eed9196c 100644 --- a/drivers/scsi/aic94xx/aic94xx_hwi.c +++ b/drivers/scsi/aic94xx/aic94xx_hwi.c | |||
@@ -1052,10 +1052,9 @@ static inline struct asd_ascb *asd_ascb_alloc(struct asd_ha_struct *asd_ha, | |||
1052 | struct asd_ascb *ascb; | 1052 | struct asd_ascb *ascb; |
1053 | unsigned long flags; | 1053 | unsigned long flags; |
1054 | 1054 | ||
1055 | ascb = kmem_cache_alloc(asd_ascb_cache, gfp_flags); | 1055 | ascb = kmem_cache_zalloc(asd_ascb_cache, gfp_flags); |
1056 | 1056 | ||
1057 | if (ascb) { | 1057 | if (ascb) { |
1058 | memset(ascb, 0, sizeof(*ascb)); | ||
1059 | ascb->dma_scb.size = sizeof(struct scb); | 1058 | ascb->dma_scb.size = sizeof(struct scb); |
1060 | ascb->dma_scb.vaddr = dma_pool_alloc(asd_ha->scb_pool, | 1059 | ascb->dma_scb.vaddr = dma_pool_alloc(asd_ha->scb_pool, |
1061 | gfp_flags, | 1060 | gfp_flags, |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index f02f48a882a9..a1cd6e6a292a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -388,10 +388,9 @@ int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, | |||
388 | int err = 0; | 388 | int err = 0; |
389 | int write = (data_direction == DMA_TO_DEVICE); | 389 | int write = (data_direction == DMA_TO_DEVICE); |
390 | 390 | ||
391 | sioc = kmem_cache_alloc(scsi_io_context_cache, gfp); | 391 | sioc = kmem_cache_zalloc(scsi_io_context_cache, gfp); |
392 | if (!sioc) | 392 | if (!sioc) |
393 | return DRIVER_ERROR << 24; | 393 | return DRIVER_ERROR << 24; |
394 | memset(sioc, 0, sizeof(*sioc)); | ||
395 | 394 | ||
396 | req = blk_get_request(sdev->request_queue, write, gfp); | 395 | req = blk_get_request(sdev->request_queue, write, gfp); |
397 | if (!req) | 396 | if (!req) |
diff --git a/drivers/usb/host/hc_crisv10.c b/drivers/usb/host/hc_crisv10.c index 282d82efc0b0..f0ffb8907f29 100644 --- a/drivers/usb/host/hc_crisv10.c +++ b/drivers/usb/host/hc_crisv10.c | |||
@@ -2163,9 +2163,8 @@ static void etrax_usb_add_to_bulk_sb_list(struct urb *urb, int epid) | |||
2163 | 2163 | ||
2164 | maxlen = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe)); | 2164 | maxlen = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe)); |
2165 | 2165 | ||
2166 | sb_desc = (USB_SB_Desc_t*)kmem_cache_alloc(usb_desc_cache, SLAB_FLAG); | 2166 | sb_desc = kmem_cache_zalloc(usb_desc_cache, SLAB_FLAG); |
2167 | assert(sb_desc != NULL); | 2167 | assert(sb_desc != NULL); |
2168 | memset(sb_desc, 0, sizeof(USB_SB_Desc_t)); | ||
2169 | 2168 | ||
2170 | 2169 | ||
2171 | if (usb_pipeout(urb->pipe)) { | 2170 | if (usb_pipeout(urb->pipe)) { |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index 2cbb239e63f8..68e66b33e726 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -624,12 +624,10 @@ static inline struct urb_priv *uhci_alloc_urb_priv(struct uhci_hcd *uhci, | |||
624 | { | 624 | { |
625 | struct urb_priv *urbp; | 625 | struct urb_priv *urbp; |
626 | 626 | ||
627 | urbp = kmem_cache_alloc(uhci_up_cachep, GFP_ATOMIC); | 627 | urbp = kmem_cache_zalloc(uhci_up_cachep, GFP_ATOMIC); |
628 | if (!urbp) | 628 | if (!urbp) |
629 | return NULL; | 629 | return NULL; |
630 | 630 | ||
631 | memset((void *)urbp, 0, sizeof(*urbp)); | ||
632 | |||
633 | urbp->urb = urb; | 631 | urbp->urb = urb; |
634 | urb->hcpriv = urbp; | 632 | urb->hcpriv = urbp; |
635 | 633 | ||