diff options
author | Mariusz Kozlowski <m.kozlowski@tuxland.pl> | 2007-08-11 04:13:24 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:41:00 -0400 |
commit | bbfbbbc1182f8b44c8cc4c99f4a3f3a512149022 (patch) | |
tree | f7e3d50cda2e3d55bff88c2cc617d60df8ddb2cb | |
parent | f36789e22ac32a6554b8e4d05ab6125fc1161745 (diff) |
[SCSI] kmalloc + memset conversion to kzalloc
In NCR_D700, a4000t, aic7xxx_old, bvme6000, dpt_i2o, gdth, lpfc,
megaraid, mvme16x osst, pluto, qla2xxx, zorro7xx
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/NCR_D700.c | 4 | ||||
-rw-r--r-- | drivers/scsi/a4000t.c | 7 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx_old.c | 8 | ||||
-rw-r--r-- | drivers/scsi/bvme6000_scsi.c | 7 | ||||
-rw-r--r-- | drivers/scsi/dpt_i2o.c | 27 | ||||
-rw-r--r-- | drivers/scsi/gdth.c | 7 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_debugfs.c | 4 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 3 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 3 | ||||
-rw-r--r-- | drivers/scsi/megaraid.c | 3 | ||||
-rw-r--r-- | drivers/scsi/mvme16x_scsi.c | 3 | ||||
-rw-r--r-- | drivers/scsi/osst.c | 5 | ||||
-rw-r--r-- | drivers/scsi/pluto.c | 8 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 14 | ||||
-rw-r--r-- | drivers/scsi/zorro7xx.c | 8 |
15 files changed, 44 insertions, 67 deletions
diff --git a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c index e0f19913a9fc..9e64b21ef637 100644 --- a/drivers/scsi/NCR_D700.c +++ b/drivers/scsi/NCR_D700.c | |||
@@ -313,10 +313,10 @@ NCR_D700_probe(struct device *dev) | |||
313 | break; | 313 | break; |
314 | } | 314 | } |
315 | 315 | ||
316 | p = kmalloc(sizeof(*p), GFP_KERNEL); | 316 | p = kzalloc(sizeof(*p), GFP_KERNEL); |
317 | if (!p) | 317 | if (!p) |
318 | return -ENOMEM; | 318 | return -ENOMEM; |
319 | memset(p, '\0', sizeof(*p)); | 319 | |
320 | p->dev = dev; | 320 | p->dev = dev; |
321 | snprintf(p->name, sizeof(p->name), "D700(%s)", dev->bus_id); | 321 | snprintf(p->name, sizeof(p->name), "D700(%s)", dev->bus_id); |
322 | if (request_irq(irq, NCR_D700_intr, IRQF_SHARED, p->name, p)) { | 322 | if (request_irq(irq, NCR_D700_intr, IRQF_SHARED, p->name, p)) { |
diff --git a/drivers/scsi/a4000t.c b/drivers/scsi/a4000t.c index 0c758d1452ba..d4bda2017746 100644 --- a/drivers/scsi/a4000t.c +++ b/drivers/scsi/a4000t.c | |||
@@ -37,7 +37,7 @@ static struct platform_device *a4000t_scsi_device; | |||
37 | 37 | ||
38 | static int __devinit a4000t_probe(struct device *dev) | 38 | static int __devinit a4000t_probe(struct device *dev) |
39 | { | 39 | { |
40 | struct Scsi_Host * host = NULL; | 40 | struct Scsi_Host *host; |
41 | struct NCR_700_Host_Parameters *hostdata; | 41 | struct NCR_700_Host_Parameters *hostdata; |
42 | 42 | ||
43 | if (!(MACH_IS_AMIGA && AMIGAHW_PRESENT(A4000_SCSI))) | 43 | if (!(MACH_IS_AMIGA && AMIGAHW_PRESENT(A4000_SCSI))) |
@@ -47,12 +47,11 @@ static int __devinit a4000t_probe(struct device *dev) | |||
47 | "A4000T builtin SCSI")) | 47 | "A4000T builtin SCSI")) |
48 | goto out; | 48 | goto out; |
49 | 49 | ||
50 | hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); | 50 | hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); |
51 | if (hostdata == NULL) { | 51 | if (!hostdata) { |
52 | printk(KERN_ERR "a4000t-scsi: Failed to allocate host data\n"); | 52 | printk(KERN_ERR "a4000t-scsi: Failed to allocate host data\n"); |
53 | goto out_release; | 53 | goto out_release; |
54 | } | 54 | } |
55 | memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters)); | ||
56 | 55 | ||
57 | /* Fill in the required pieces of hostdata */ | 56 | /* Fill in the required pieces of hostdata */ |
58 | hostdata->base = (void __iomem *)ZTWO_VADDR(A4000T_SCSI_ADDR); | 57 | hostdata->base = (void __iomem *)ZTWO_VADDR(A4000T_SCSI_ADDR); |
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index 4998bb850c49..1a71b0236c97 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c | |||
@@ -8416,10 +8416,9 @@ aic7xxx_alloc(struct scsi_host_template *sht, struct aic7xxx_host *temp) | |||
8416 | *p = *temp; | 8416 | *p = *temp; |
8417 | p->host = host; | 8417 | p->host = host; |
8418 | 8418 | ||
8419 | p->scb_data = kmalloc(sizeof(scb_data_type), GFP_ATOMIC); | 8419 | p->scb_data = kzalloc(sizeof(scb_data_type), GFP_ATOMIC); |
8420 | if (p->scb_data != NULL) | 8420 | if (!p->scb_data) |
8421 | { | 8421 | { |
8422 | memset(p->scb_data, 0, sizeof(scb_data_type)); | ||
8423 | scbq_init (&p->scb_data->free_scbs); | 8422 | scbq_init (&p->scb_data->free_scbs); |
8424 | } | 8423 | } |
8425 | else | 8424 | else |
@@ -9196,10 +9195,9 @@ aic7xxx_detect(struct scsi_host_template *template) | |||
9196 | printk(KERN_INFO " this driver, we are ignoring it.\n"); | 9195 | printk(KERN_INFO " this driver, we are ignoring it.\n"); |
9197 | } | 9196 | } |
9198 | } | 9197 | } |
9199 | else if ( (temp_p = kmalloc(sizeof(struct aic7xxx_host), | 9198 | else if ( (temp_p = kzalloc(sizeof(struct aic7xxx_host), |
9200 | GFP_ATOMIC)) != NULL ) | 9199 | GFP_ATOMIC)) != NULL ) |
9201 | { | 9200 | { |
9202 | memset(temp_p, 0, sizeof(struct aic7xxx_host)); | ||
9203 | temp_p->chip = aic_pdevs[i].chip | AHC_PCI; | 9201 | temp_p->chip = aic_pdevs[i].chip | AHC_PCI; |
9204 | temp_p->flags = aic_pdevs[i].flags; | 9202 | temp_p->flags = aic_pdevs[i].flags; |
9205 | temp_p->features = aic_pdevs[i].features; | 9203 | temp_p->features = aic_pdevs[i].features; |
diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c index cac354086737..d858f3d41274 100644 --- a/drivers/scsi/bvme6000_scsi.c +++ b/drivers/scsi/bvme6000_scsi.c | |||
@@ -36,19 +36,18 @@ static struct platform_device *bvme6000_scsi_device; | |||
36 | static __devinit int | 36 | static __devinit int |
37 | bvme6000_probe(struct device *dev) | 37 | bvme6000_probe(struct device *dev) |
38 | { | 38 | { |
39 | struct Scsi_Host * host = NULL; | 39 | struct Scsi_Host *host; |
40 | struct NCR_700_Host_Parameters *hostdata; | 40 | struct NCR_700_Host_Parameters *hostdata; |
41 | 41 | ||
42 | if (!MACH_IS_BVME6000) | 42 | if (!MACH_IS_BVME6000) |
43 | goto out; | 43 | goto out; |
44 | 44 | ||
45 | hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); | 45 | hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); |
46 | if (hostdata == NULL) { | 46 | if (!hostdata) { |
47 | printk(KERN_ERR "bvme6000-scsi: " | 47 | printk(KERN_ERR "bvme6000-scsi: " |
48 | "Failed to allocate host data\n"); | 48 | "Failed to allocate host data\n"); |
49 | goto out; | 49 | goto out; |
50 | } | 50 | } |
51 | memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters)); | ||
52 | 51 | ||
53 | /* Fill in the required pieces of hostdata */ | 52 | /* Fill in the required pieces of hostdata */ |
54 | hostdata->base = (void __iomem *)BVME_NCR53C710_BASE; | 53 | hostdata->base = (void __iomem *)BVME_NCR53C710_BASE; |
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 502732ac270d..9d7bdf73e1e3 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -949,16 +949,14 @@ static int adpt_install_hba(struct pci_dev* pDev) | |||
949 | } | 949 | } |
950 | 950 | ||
951 | // Allocate and zero the data structure | 951 | // Allocate and zero the data structure |
952 | pHba = kmalloc(sizeof(adpt_hba), GFP_KERNEL); | 952 | pHba = kzalloc(sizeof(adpt_hba), GFP_KERNEL); |
953 | if( pHba == NULL) { | 953 | if (!pHba) { |
954 | if(msg_addr_virt != base_addr_virt){ | 954 | if (msg_addr_virt != base_addr_virt) |
955 | iounmap(msg_addr_virt); | 955 | iounmap(msg_addr_virt); |
956 | } | ||
957 | iounmap(base_addr_virt); | 956 | iounmap(base_addr_virt); |
958 | pci_release_regions(pDev); | 957 | pci_release_regions(pDev); |
959 | return -ENOMEM; | 958 | return -ENOMEM; |
960 | } | 959 | } |
961 | memset(pHba, 0, sizeof(adpt_hba)); | ||
962 | 960 | ||
963 | mutex_lock(&adpt_configuration_lock); | 961 | mutex_lock(&adpt_configuration_lock); |
964 | 962 | ||
@@ -2622,14 +2620,13 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba) | |||
2622 | 2620 | ||
2623 | msg=(u32 __iomem *)(pHba->msg_addr_virt+m); | 2621 | msg=(u32 __iomem *)(pHba->msg_addr_virt+m); |
2624 | 2622 | ||
2625 | status = kmalloc(4,GFP_KERNEL|ADDR32); | 2623 | status = kzalloc(4, GFP_KERNEL|ADDR32); |
2626 | if (status==NULL) { | 2624 | if (!status) { |
2627 | adpt_send_nop(pHba, m); | 2625 | adpt_send_nop(pHba, m); |
2628 | printk(KERN_WARNING"%s: IOP reset failed - no free memory.\n", | 2626 | printk(KERN_WARNING"%s: IOP reset failed - no free memory.\n", |
2629 | pHba->name); | 2627 | pHba->name); |
2630 | return -ENOMEM; | 2628 | return -ENOMEM; |
2631 | } | 2629 | } |
2632 | memset(status, 0, 4); | ||
2633 | 2630 | ||
2634 | writel(EIGHT_WORD_MSG_SIZE| SGL_OFFSET_6, &msg[0]); | 2631 | writel(EIGHT_WORD_MSG_SIZE| SGL_OFFSET_6, &msg[0]); |
2635 | writel(I2O_CMD_OUTBOUND_INIT<<24 | HOST_TID<<12 | ADAPTER_TID, &msg[1]); | 2632 | writel(I2O_CMD_OUTBOUND_INIT<<24 | HOST_TID<<12 | ADAPTER_TID, &msg[1]); |
@@ -2668,12 +2665,11 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba) | |||
2668 | 2665 | ||
2669 | kfree(pHba->reply_pool); | 2666 | kfree(pHba->reply_pool); |
2670 | 2667 | ||
2671 | pHba->reply_pool = kmalloc(pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, GFP_KERNEL|ADDR32); | 2668 | pHba->reply_pool = kzalloc(pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, GFP_KERNEL|ADDR32); |
2672 | if(!pHba->reply_pool){ | 2669 | if (!pHba->reply_pool) { |
2673 | printk(KERN_ERR"%s: Could not allocate reply pool\n",pHba->name); | 2670 | printk(KERN_ERR "%s: Could not allocate reply pool\n", pHba->name); |
2674 | return -1; | 2671 | return -ENOMEM; |
2675 | } | 2672 | } |
2676 | memset(pHba->reply_pool, 0 , pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4); | ||
2677 | 2673 | ||
2678 | ptr = pHba->reply_pool; | 2674 | ptr = pHba->reply_pool; |
2679 | for(i = 0; i < pHba->reply_fifo_size; i++) { | 2675 | for(i = 0; i < pHba->reply_fifo_size; i++) { |
@@ -2884,12 +2880,11 @@ static int adpt_i2o_build_sys_table(void) | |||
2884 | 2880 | ||
2885 | kfree(sys_tbl); | 2881 | kfree(sys_tbl); |
2886 | 2882 | ||
2887 | sys_tbl = kmalloc(sys_tbl_len, GFP_KERNEL|ADDR32); | 2883 | sys_tbl = kzalloc(sys_tbl_len, GFP_KERNEL|ADDR32); |
2888 | if(!sys_tbl) { | 2884 | if (!sys_tbl) { |
2889 | printk(KERN_WARNING "SysTab Set failed. Out of memory.\n"); | 2885 | printk(KERN_WARNING "SysTab Set failed. Out of memory.\n"); |
2890 | return -ENOMEM; | 2886 | return -ENOMEM; |
2891 | } | 2887 | } |
2892 | memset(sys_tbl, 0, sys_tbl_len); | ||
2893 | 2888 | ||
2894 | sys_tbl->num_entries = hba_count; | 2889 | sys_tbl->num_entries = hba_count; |
2895 | sys_tbl->version = I2OVERSION; | 2890 | sys_tbl->version = I2OVERSION; |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 55e4d2dc2bbe..b20c188cc529 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -726,10 +726,10 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, | |||
726 | DECLARE_COMPLETION_ONSTACK(wait); | 726 | DECLARE_COMPLETION_ONSTACK(wait); |
727 | int rval; | 727 | int rval; |
728 | 728 | ||
729 | scp = kmalloc(sizeof(*scp), GFP_KERNEL); | 729 | scp = kzalloc(sizeof(*scp), GFP_KERNEL); |
730 | if (!scp) | 730 | if (!scp) |
731 | return -ENOMEM; | 731 | return -ENOMEM; |
732 | memset(scp, 0, sizeof(*scp)); | 732 | |
733 | scp->device = sdev; | 733 | scp->device = sdev; |
734 | /* use request field to save the ptr. to completion struct. */ | 734 | /* use request field to save the ptr. to completion struct. */ |
735 | scp->request = (struct request *)&wait; | 735 | scp->request = (struct request *)&wait; |
@@ -5518,10 +5518,9 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, | |||
5518 | ha = HADATA(gdth_ctr_tab[hanum]); | 5518 | ha = HADATA(gdth_ctr_tab[hanum]); |
5519 | 5519 | ||
5520 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) | 5520 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) |
5521 | scp = kmalloc(sizeof(*scp), GFP_KERNEL); | 5521 | scp = kzalloc(sizeof(*scp), GFP_KERNEL); |
5522 | if (!scp) | 5522 | if (!scp) |
5523 | return -ENOMEM; | 5523 | return -ENOMEM; |
5524 | memset(scp, 0, sizeof(*scp)); | ||
5525 | scp->device = ha->sdev; | 5524 | scp->device = ha->sdev; |
5526 | scp->cmd_len = 12; | 5525 | scp->cmd_len = 12; |
5527 | scp->use_sg = 0; | 5526 | scp->use_sg = 0; |
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index dcf808be0fb0..149fdd25f8e8 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | |||
@@ -901,7 +901,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) | |||
901 | } | 901 | } |
902 | } | 902 | } |
903 | 903 | ||
904 | vport->disc_trc = kmalloc( | 904 | vport->disc_trc = kmzlloc( |
905 | (sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_disc_trc), | 905 | (sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_disc_trc), |
906 | GFP_KERNEL); | 906 | GFP_KERNEL); |
907 | 907 | ||
@@ -912,8 +912,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) | |||
912 | goto debug_failed; | 912 | goto debug_failed; |
913 | } | 913 | } |
914 | atomic_set(&vport->disc_trc_cnt, 0); | 914 | atomic_set(&vport->disc_trc_cnt, 0); |
915 | memset(vport->disc_trc, 0, | ||
916 | (sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_disc_trc)); | ||
917 | 915 | ||
918 | snprintf(name, sizeof(name), "discovery_trace"); | 916 | snprintf(name, sizeof(name), "discovery_trace"); |
919 | vport->debug_disc_trc = | 917 | vport->debug_disc_trc = |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 42e20612df80..ecebdfa00470 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -1265,11 +1265,10 @@ lpfc_hba_init(struct lpfc_hba *phba, uint32_t *hbainit) | |||
1265 | uint32_t *HashWorking; | 1265 | uint32_t *HashWorking; |
1266 | uint32_t *pwwnn = (uint32_t *) phba->wwnn; | 1266 | uint32_t *pwwnn = (uint32_t *) phba->wwnn; |
1267 | 1267 | ||
1268 | HashWorking = kmalloc(80 * sizeof(uint32_t), GFP_KERNEL); | 1268 | HashWorking = kcalloc(80, sizeof(uint32_t), GFP_KERNEL); |
1269 | if (!HashWorking) | 1269 | if (!HashWorking) |
1270 | return; | 1270 | return; |
1271 | 1271 | ||
1272 | memset(HashWorking, 0, (80 * sizeof(uint32_t))); | ||
1273 | HashWorking[0] = HashWorking[78] = *pwwnn++; | 1272 | HashWorking[0] = HashWorking[78] = *pwwnn++; |
1274 | HashWorking[1] = HashWorking[79] = *pwwnn; | 1273 | HashWorking[1] = HashWorking[79] = *pwwnn; |
1275 | 1274 | ||
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 17d7dc05149b..cd674938ccd5 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -202,10 +202,9 @@ lpfc_new_scsi_buf(struct lpfc_vport *vport) | |||
202 | dma_addr_t pdma_phys; | 202 | dma_addr_t pdma_phys; |
203 | uint16_t iotag; | 203 | uint16_t iotag; |
204 | 204 | ||
205 | psb = kmalloc(sizeof(struct lpfc_scsi_buf), GFP_KERNEL); | 205 | psb = kzalloc(sizeof(struct lpfc_scsi_buf), GFP_KERNEL); |
206 | if (!psb) | 206 | if (!psb) |
207 | return NULL; | 207 | return NULL; |
208 | memset(psb, 0, sizeof (struct lpfc_scsi_buf)); | ||
209 | 208 | ||
210 | /* | 209 | /* |
211 | * Get memory from the pci pool to map the virt space to pci bus space | 210 | * Get memory from the pci pool to map the virt space to pci bus space |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 3907f6718ede..9023ec6a0f8e 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -4408,8 +4408,7 @@ mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru) | |||
4408 | scmd = &adapter->int_scmd; | 4408 | scmd = &adapter->int_scmd; |
4409 | memset(scmd, 0, sizeof(Scsi_Cmnd)); | 4409 | memset(scmd, 0, sizeof(Scsi_Cmnd)); |
4410 | 4410 | ||
4411 | sdev = kmalloc(sizeof(struct scsi_device), GFP_KERNEL); | 4411 | sdev = kzalloc(sizeof(struct scsi_device), GFP_KERNEL); |
4412 | memset(sdev, 0, sizeof(struct scsi_device)); | ||
4413 | scmd->device = sdev; | 4412 | scmd->device = sdev; |
4414 | 4413 | ||
4415 | scmd->device->host = adapter->host; | 4414 | scmd->device->host = adapter->host; |
diff --git a/drivers/scsi/mvme16x_scsi.c b/drivers/scsi/mvme16x_scsi.c index 1bdddad48571..b264b499d982 100644 --- a/drivers/scsi/mvme16x_scsi.c +++ b/drivers/scsi/mvme16x_scsi.c | |||
@@ -48,13 +48,12 @@ mvme16x_probe(struct device *dev) | |||
48 | goto out; | 48 | goto out; |
49 | } | 49 | } |
50 | 50 | ||
51 | hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); | 51 | hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); |
52 | if (hostdata == NULL) { | 52 | if (hostdata == NULL) { |
53 | printk(KERN_ERR "mvme16x-scsi: " | 53 | printk(KERN_ERR "mvme16x-scsi: " |
54 | "Failed to allocate host data\n"); | 54 | "Failed to allocate host data\n"); |
55 | goto out; | 55 | goto out; |
56 | } | 56 | } |
57 | memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters)); | ||
58 | 57 | ||
59 | /* Fill in the required pieces of hostdata */ | 58 | /* Fill in the required pieces of hostdata */ |
60 | hostdata->base = (void __iomem *)0xfff47000UL; | 59 | hostdata->base = (void __iomem *)0xfff47000UL; |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 08060fb478b6..119739502095 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -5778,13 +5778,12 @@ static int osst_probe(struct device *dev) | |||
5778 | dev_num = i; | 5778 | dev_num = i; |
5779 | 5779 | ||
5780 | /* allocate a struct osst_tape for this device */ | 5780 | /* allocate a struct osst_tape for this device */ |
5781 | tpnt = kmalloc(sizeof(struct osst_tape), GFP_ATOMIC); | 5781 | tpnt = kzalloc(sizeof(struct osst_tape), GFP_ATOMIC); |
5782 | if (tpnt == NULL) { | 5782 | if (!tpnt) { |
5783 | write_unlock(&os_scsi_tapes_lock); | 5783 | write_unlock(&os_scsi_tapes_lock); |
5784 | printk(KERN_ERR "osst :E: Can't allocate device descriptor, device not attached.\n"); | 5784 | printk(KERN_ERR "osst :E: Can't allocate device descriptor, device not attached.\n"); |
5785 | goto out_put_disk; | 5785 | goto out_put_disk; |
5786 | } | 5786 | } |
5787 | memset(tpnt, 0, sizeof(struct osst_tape)); | ||
5788 | 5787 | ||
5789 | /* allocate a buffer for this device */ | 5788 | /* allocate a buffer for this device */ |
5790 | i = SDp->host->sg_tablesize; | 5789 | i = SDp->host->sg_tablesize; |
diff --git a/drivers/scsi/pluto.c b/drivers/scsi/pluto.c index d953d43fe2e6..e2213894917f 100644 --- a/drivers/scsi/pluto.c +++ b/drivers/scsi/pluto.c | |||
@@ -111,13 +111,12 @@ int __init pluto_detect(struct scsi_host_template *tpnt) | |||
111 | #endif | 111 | #endif |
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | fcs = kmalloc(sizeof (struct ctrl_inquiry) * fcscount, GFP_DMA); | 114 | fcs = kcalloc(fcscount, sizeof (struct ctrl_inquiry), GFP_DMA); |
115 | if (!fcs) { | 115 | if (!fcs) { |
116 | printk ("PLUTO: Not enough memory to probe\n"); | 116 | printk ("PLUTO: Not enough memory to probe\n"); |
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
119 | 119 | ||
120 | memset (fcs, 0, sizeof (struct ctrl_inquiry) * fcscount); | ||
121 | memset (&dev, 0, sizeof(dev)); | 120 | memset (&dev, 0, sizeof(dev)); |
122 | atomic_set (&fcss, fcscount); | 121 | atomic_set (&fcss, fcscount); |
123 | 122 | ||
@@ -211,7 +210,7 @@ int __init pluto_detect(struct scsi_host_template *tpnt) | |||
211 | char *p; | 210 | char *p; |
212 | long *ages; | 211 | long *ages; |
213 | 212 | ||
214 | ages = kmalloc (((inq->channels + 1) * inq->targets) * sizeof(long), GFP_KERNEL); | 213 | ages = kcalloc((inq->channels + 1) * inq->targets, sizeof(long), GFP_KERNEL); |
215 | if (!ages) continue; | 214 | if (!ages) continue; |
216 | 215 | ||
217 | host = scsi_register (tpnt, sizeof (struct pluto)); | 216 | host = scsi_register (tpnt, sizeof (struct pluto)); |
@@ -238,7 +237,6 @@ int __init pluto_detect(struct scsi_host_template *tpnt) | |||
238 | fc->channels = inq->channels + 1; | 237 | fc->channels = inq->channels + 1; |
239 | fc->targets = inq->targets; | 238 | fc->targets = inq->targets; |
240 | fc->ages = ages; | 239 | fc->ages = ages; |
241 | memset (ages, 0, ((inq->channels + 1) * inq->targets) * sizeof(long)); | ||
242 | 240 | ||
243 | pluto->fc = fc; | 241 | pluto->fc = fc; |
244 | memcpy (pluto->rev_str, inq->revision, 4); | 242 | memcpy (pluto->rev_str, inq->revision, 4); |
@@ -260,7 +258,7 @@ int __init pluto_detect(struct scsi_host_template *tpnt) | |||
260 | } else | 258 | } else |
261 | fc->fcp_register(fc, TYPE_SCSI_FCP, 1); | 259 | fc->fcp_register(fc, TYPE_SCSI_FCP, 1); |
262 | } | 260 | } |
263 | kfree((char *)fcs); | 261 | kfree(fcs); |
264 | if (nplutos) | 262 | if (nplutos) |
265 | printk ("PLUTO: Total of %d SparcSTORAGE Arrays found\n", nplutos); | 263 | printk ("PLUTO: Total of %d SparcSTORAGE Arrays found\n", nplutos); |
266 | return nplutos; | 264 | return nplutos; |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 1a058ec9bd0c..083997c3066e 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -1786,12 +1786,11 @@ qla2x00_alloc_fcport(scsi_qla_host_t *ha, gfp_t flags) | |||
1786 | { | 1786 | { |
1787 | fc_port_t *fcport; | 1787 | fc_port_t *fcport; |
1788 | 1788 | ||
1789 | fcport = kmalloc(sizeof(fc_port_t), flags); | 1789 | fcport = kzalloc(sizeof(fc_port_t), flags); |
1790 | if (fcport == NULL) | 1790 | if (!fcport) |
1791 | return (fcport); | 1791 | return NULL; |
1792 | 1792 | ||
1793 | /* Setup fcport template structure. */ | 1793 | /* Setup fcport template structure. */ |
1794 | memset(fcport, 0, sizeof (fc_port_t)); | ||
1795 | fcport->ha = ha; | 1794 | fcport->ha = ha; |
1796 | fcport->vp_idx = ha->vp_idx; | 1795 | fcport->vp_idx = ha->vp_idx; |
1797 | fcport->port_type = FCT_UNKNOWN; | 1796 | fcport->port_type = FCT_UNKNOWN; |
@@ -1801,7 +1800,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *ha, gfp_t flags) | |||
1801 | fcport->supported_classes = FC_COS_UNSPECIFIED; | 1800 | fcport->supported_classes = FC_COS_UNSPECIFIED; |
1802 | spin_lock_init(&fcport->rport_lock); | 1801 | spin_lock_init(&fcport->rport_lock); |
1803 | 1802 | ||
1804 | return (fcport); | 1803 | return fcport; |
1805 | } | 1804 | } |
1806 | 1805 | ||
1807 | /* | 1806 | /* |
@@ -2473,13 +2472,12 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports) | |||
2473 | rval = QLA_SUCCESS; | 2472 | rval = QLA_SUCCESS; |
2474 | 2473 | ||
2475 | /* Try GID_PT to get device list, else GAN. */ | 2474 | /* Try GID_PT to get device list, else GAN. */ |
2476 | swl = kmalloc(sizeof(sw_info_t) * MAX_FIBRE_DEVICES, GFP_ATOMIC); | 2475 | swl = kcalloc(MAX_FIBRE_DEVICES, sizeof(sw_info_t), GFP_ATOMIC); |
2477 | if (swl == NULL) { | 2476 | if (!swl) { |
2478 | /*EMPTY*/ | 2477 | /*EMPTY*/ |
2479 | DEBUG2(printk("scsi(%ld): GID_PT allocations failed, fallback " | 2478 | DEBUG2(printk("scsi(%ld): GID_PT allocations failed, fallback " |
2480 | "on GA_NXT\n", ha->host_no)); | 2479 | "on GA_NXT\n", ha->host_no)); |
2481 | } else { | 2480 | } else { |
2482 | memset(swl, 0, sizeof(sw_info_t) * MAX_FIBRE_DEVICES); | ||
2483 | if (qla2x00_gid_pt(ha, swl) != QLA_SUCCESS) { | 2481 | if (qla2x00_gid_pt(ha, swl) != QLA_SUCCESS) { |
2484 | kfree(swl); | 2482 | kfree(swl); |
2485 | swl = NULL; | 2483 | swl = NULL; |
diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c index c822debc2668..ac67394c7373 100644 --- a/drivers/scsi/zorro7xx.c +++ b/drivers/scsi/zorro7xx.c | |||
@@ -69,7 +69,7 @@ static struct zorro_device_id zorro7xx_zorro_tbl[] __devinitdata = { | |||
69 | static int __devinit zorro7xx_init_one(struct zorro_dev *z, | 69 | static int __devinit zorro7xx_init_one(struct zorro_dev *z, |
70 | const struct zorro_device_id *ent) | 70 | const struct zorro_device_id *ent) |
71 | { | 71 | { |
72 | struct Scsi_Host * host = NULL; | 72 | struct Scsi_Host *host; |
73 | struct NCR_700_Host_Parameters *hostdata; | 73 | struct NCR_700_Host_Parameters *hostdata; |
74 | struct zorro_driver_data *zdd; | 74 | struct zorro_driver_data *zdd; |
75 | unsigned long board, ioaddr; | 75 | unsigned long board, ioaddr; |
@@ -89,14 +89,12 @@ static int __devinit zorro7xx_init_one(struct zorro_dev *z, | |||
89 | return -EBUSY; | 89 | return -EBUSY; |
90 | } | 90 | } |
91 | 91 | ||
92 | hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); | 92 | hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); |
93 | if (hostdata == NULL) { | 93 | if (!hostdata) { |
94 | printk(KERN_ERR "zorro7xx: Failed to allocate host data\n"); | 94 | printk(KERN_ERR "zorro7xx: Failed to allocate host data\n"); |
95 | goto out_release; | 95 | goto out_release; |
96 | } | 96 | } |
97 | 97 | ||
98 | memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters)); | ||
99 | |||
100 | /* Fill in the required pieces of hostdata */ | 98 | /* Fill in the required pieces of hostdata */ |
101 | if (ioaddr > 0x01000000) | 99 | if (ioaddr > 0x01000000) |
102 | hostdata->base = ioremap(ioaddr, zorro_resource_len(z)); | 100 | hostdata->base = ioremap(ioaddr, zorro_resource_len(z)); |