diff options
author | brking@us.ibm.com <brking@us.ibm.com> | 2005-11-01 18:01:20 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-11-06 14:03:45 -0500 |
commit | 0bc42e35c74c0baab414cf623d6fe1e94cee4ca3 (patch) | |
tree | cb826cb781e7447f09b1a63bcf51d4224ea6a622 /drivers/scsi/ipr.c | |
parent | 622750406a1b4b230f1ee595cb555e5d9222feeb (diff) |
[SCSI] ipr: Convert to use kzalloc
Convert appropriate kmalloc/memset calls to use kzalloc.
Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/ipr.c')
-rw-r--r-- | drivers/scsi/ipr.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 7149aada3f3c..ad13ae11e2e6 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -2248,7 +2248,7 @@ static struct ipr_sglist *ipr_alloc_ucode_buffer(int buf_len) | |||
2248 | num_elem = buf_len / bsize_elem; | 2248 | num_elem = buf_len / bsize_elem; |
2249 | 2249 | ||
2250 | /* Allocate a scatter/gather list for the DMA */ | 2250 | /* Allocate a scatter/gather list for the DMA */ |
2251 | sglist = kmalloc(sizeof(struct ipr_sglist) + | 2251 | sglist = kzalloc(sizeof(struct ipr_sglist) + |
2252 | (sizeof(struct scatterlist) * (num_elem - 1)), | 2252 | (sizeof(struct scatterlist) * (num_elem - 1)), |
2253 | GFP_KERNEL); | 2253 | GFP_KERNEL); |
2254 | 2254 | ||
@@ -2257,9 +2257,6 @@ static struct ipr_sglist *ipr_alloc_ucode_buffer(int buf_len) | |||
2257 | return NULL; | 2257 | return NULL; |
2258 | } | 2258 | } |
2259 | 2259 | ||
2260 | memset(sglist, 0, sizeof(struct ipr_sglist) + | ||
2261 | (sizeof(struct scatterlist) * (num_elem - 1))); | ||
2262 | |||
2263 | scatterlist = sglist->scatterlist; | 2260 | scatterlist = sglist->scatterlist; |
2264 | 2261 | ||
2265 | sglist->order = order; | 2262 | sglist->order = order; |
@@ -2614,14 +2611,13 @@ static int ipr_alloc_dump(struct ipr_ioa_cfg *ioa_cfg) | |||
2614 | unsigned long lock_flags = 0; | 2611 | unsigned long lock_flags = 0; |
2615 | 2612 | ||
2616 | ENTER; | 2613 | ENTER; |
2617 | dump = kmalloc(sizeof(struct ipr_dump), GFP_KERNEL); | 2614 | dump = kzalloc(sizeof(struct ipr_dump), GFP_KERNEL); |
2618 | 2615 | ||
2619 | if (!dump) { | 2616 | if (!dump) { |
2620 | ipr_err("Dump memory allocation failed\n"); | 2617 | ipr_err("Dump memory allocation failed\n"); |
2621 | return -ENOMEM; | 2618 | return -ENOMEM; |
2622 | } | 2619 | } |
2623 | 2620 | ||
2624 | memset(dump, 0, sizeof(struct ipr_dump)); | ||
2625 | kref_init(&dump->kref); | 2621 | kref_init(&dump->kref); |
2626 | dump->ioa_cfg = ioa_cfg; | 2622 | dump->ioa_cfg = ioa_cfg; |
2627 | 2623 | ||
@@ -5665,15 +5661,12 @@ static int __devinit ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg) | |||
5665 | int i, rc = -ENOMEM; | 5661 | int i, rc = -ENOMEM; |
5666 | 5662 | ||
5667 | ENTER; | 5663 | ENTER; |
5668 | ioa_cfg->res_entries = kmalloc(sizeof(struct ipr_resource_entry) * | 5664 | ioa_cfg->res_entries = kzalloc(sizeof(struct ipr_resource_entry) * |
5669 | IPR_MAX_PHYSICAL_DEVS, GFP_KERNEL); | 5665 | IPR_MAX_PHYSICAL_DEVS, GFP_KERNEL); |
5670 | 5666 | ||
5671 | if (!ioa_cfg->res_entries) | 5667 | if (!ioa_cfg->res_entries) |
5672 | goto out; | 5668 | goto out; |
5673 | 5669 | ||
5674 | memset(ioa_cfg->res_entries, 0, | ||
5675 | sizeof(struct ipr_resource_entry) * IPR_MAX_PHYSICAL_DEVS); | ||
5676 | |||
5677 | for (i = 0; i < IPR_MAX_PHYSICAL_DEVS; i++) | 5670 | for (i = 0; i < IPR_MAX_PHYSICAL_DEVS; i++) |
5678 | list_add_tail(&ioa_cfg->res_entries[i].queue, &ioa_cfg->free_res_q); | 5671 | list_add_tail(&ioa_cfg->res_entries[i].queue, &ioa_cfg->free_res_q); |
5679 | 5672 | ||
@@ -5714,15 +5707,12 @@ static int __devinit ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg) | |||
5714 | list_add_tail(&ioa_cfg->hostrcb[i]->queue, &ioa_cfg->hostrcb_free_q); | 5707 | list_add_tail(&ioa_cfg->hostrcb[i]->queue, &ioa_cfg->hostrcb_free_q); |
5715 | } | 5708 | } |
5716 | 5709 | ||
5717 | ioa_cfg->trace = kmalloc(sizeof(struct ipr_trace_entry) * | 5710 | ioa_cfg->trace = kzalloc(sizeof(struct ipr_trace_entry) * |
5718 | IPR_NUM_TRACE_ENTRIES, GFP_KERNEL); | 5711 | IPR_NUM_TRACE_ENTRIES, GFP_KERNEL); |
5719 | 5712 | ||
5720 | if (!ioa_cfg->trace) | 5713 | if (!ioa_cfg->trace) |
5721 | goto out_free_hostrcb_dma; | 5714 | goto out_free_hostrcb_dma; |
5722 | 5715 | ||
5723 | memset(ioa_cfg->trace, 0, | ||
5724 | sizeof(struct ipr_trace_entry) * IPR_NUM_TRACE_ENTRIES); | ||
5725 | |||
5726 | rc = 0; | 5716 | rc = 0; |
5727 | out: | 5717 | out: |
5728 | LEAVE; | 5718 | LEAVE; |