Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbfbbbc1 authored by Mariusz Kozlowski's avatar Mariusz Kozlowski Committed by James Bottomley
Browse files

[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: default avatarMariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent f36789e2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -313,10 +313,10 @@ NCR_D700_probe(struct device *dev)
		break;
	}

	p = kmalloc(sizeof(*p), GFP_KERNEL);
	p = kzalloc(sizeof(*p), GFP_KERNEL);
	if (!p)
		return -ENOMEM;
	memset(p, '\0', sizeof(*p));

	p->dev = dev;
	snprintf(p->name, sizeof(p->name), "D700(%s)", dev->bus_id);
	if (request_irq(irq, NCR_D700_intr, IRQF_SHARED, p->name, p)) {
+3 −4
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ static struct platform_device *a4000t_scsi_device;

static int __devinit a4000t_probe(struct device *dev)
{
	struct Scsi_Host * host = NULL;
	struct Scsi_Host *host;
	struct NCR_700_Host_Parameters *hostdata;

	if (!(MACH_IS_AMIGA && AMIGAHW_PRESENT(A4000_SCSI)))
@@ -47,12 +47,11 @@ static int __devinit a4000t_probe(struct device *dev)
				"A4000T builtin SCSI"))
		goto out;

	hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
	if (hostdata == NULL) {
	hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
	if (!hostdata) {
		printk(KERN_ERR "a4000t-scsi: Failed to allocate host data\n");
		goto out_release;
	}
	memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));

	/* Fill in the required pieces of hostdata */
	hostdata->base = (void __iomem *)ZTWO_VADDR(A4000T_SCSI_ADDR);
+3 −5
Original line number Diff line number Diff line
@@ -8416,10 +8416,9 @@ aic7xxx_alloc(struct scsi_host_template *sht, struct aic7xxx_host *temp)
    *p = *temp;
    p->host = host;

    p->scb_data = kmalloc(sizeof(scb_data_type), GFP_ATOMIC);
    if (p->scb_data != NULL)
    p->scb_data = kzalloc(sizeof(scb_data_type), GFP_ATOMIC);
    if (!p->scb_data)
    {
      memset(p->scb_data, 0, sizeof(scb_data_type));
      scbq_init (&p->scb_data->free_scbs);
    }
    else
@@ -9196,10 +9195,9 @@ aic7xxx_detect(struct scsi_host_template *template)
            printk(KERN_INFO "         this driver, we are ignoring it.\n");
          }
        }
        else if ( (temp_p = kmalloc(sizeof(struct aic7xxx_host),
        else if ( (temp_p = kzalloc(sizeof(struct aic7xxx_host),
                                    GFP_ATOMIC)) != NULL )
        {
          memset(temp_p, 0, sizeof(struct aic7xxx_host));
          temp_p->chip = aic_pdevs[i].chip | AHC_PCI;
          temp_p->flags = aic_pdevs[i].flags;
          temp_p->features = aic_pdevs[i].features;
+3 −4
Original line number Diff line number Diff line
@@ -36,19 +36,18 @@ static struct platform_device *bvme6000_scsi_device;
static __devinit int
bvme6000_probe(struct device *dev)
{
	struct Scsi_Host * host = NULL;
	struct Scsi_Host *host;
	struct NCR_700_Host_Parameters *hostdata;

	if (!MACH_IS_BVME6000)
		goto out;

	hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
	if (hostdata == NULL) {
	hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
	if (!hostdata) {
		printk(KERN_ERR "bvme6000-scsi: "
				"Failed to allocate host data\n");
		goto out;
	}
	memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));

	/* Fill in the required pieces of hostdata */
	hostdata->base = (void __iomem *)BVME_NCR53C710_BASE;
+11 −16
Original line number Diff line number Diff line
@@ -949,16 +949,14 @@ static int adpt_install_hba(struct pci_dev* pDev)
	}
	
	// Allocate and zero the data structure
	pHba = kmalloc(sizeof(adpt_hba), GFP_KERNEL);
	if( pHba == NULL) {
		if(msg_addr_virt != base_addr_virt){
	pHba = kzalloc(sizeof(adpt_hba), GFP_KERNEL);
	if (!pHba) {
		if (msg_addr_virt != base_addr_virt)
			iounmap(msg_addr_virt);
		}
		iounmap(base_addr_virt);
		pci_release_regions(pDev);
		return -ENOMEM;
	}
	memset(pHba, 0, sizeof(adpt_hba));

	mutex_lock(&adpt_configuration_lock);

@@ -2622,14 +2620,13 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba)

	msg=(u32 __iomem *)(pHba->msg_addr_virt+m);

	status = kmalloc(4,GFP_KERNEL|ADDR32);
	if (status==NULL) {
	status = kzalloc(4, GFP_KERNEL|ADDR32);
	if (!status) {
		adpt_send_nop(pHba, m);
		printk(KERN_WARNING"%s: IOP reset failed - no free memory.\n",
			pHba->name);
		return -ENOMEM;
	}
	memset(status, 0, 4);

	writel(EIGHT_WORD_MSG_SIZE| SGL_OFFSET_6, &msg[0]);
	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)

	kfree(pHba->reply_pool);

	pHba->reply_pool = kmalloc(pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, GFP_KERNEL|ADDR32);
	pHba->reply_pool = kzalloc(pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, GFP_KERNEL|ADDR32);
	if (!pHba->reply_pool) {
		printk(KERN_ERR "%s: Could not allocate reply pool\n", pHba->name);
		return -1;
		return -ENOMEM;
	}
	memset(pHba->reply_pool, 0 , pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4);

	ptr = pHba->reply_pool;
	for(i = 0; i < pHba->reply_fifo_size; i++) {
@@ -2884,12 +2880,11 @@ static int adpt_i2o_build_sys_table(void)

	kfree(sys_tbl);

	sys_tbl = kmalloc(sys_tbl_len, GFP_KERNEL|ADDR32);
	sys_tbl = kzalloc(sys_tbl_len, GFP_KERNEL|ADDR32);
	if (!sys_tbl) {
		printk(KERN_WARNING "SysTab Set failed. Out of memory.\n");	
		return -ENOMEM;
	}
	memset(sys_tbl, 0, sys_tbl_len);

	sys_tbl->num_entries = hba_count;
	sys_tbl->version = I2OVERSION;
Loading