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

Commit 7c845eb5 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

scsi: use pci_zalloc_consistent



Remove the now unnecessary memset too.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Adam Radford <linuxraid@lsi.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Cc: Dario Ballabio <ballabio_dario@emc.com>
Cc: Michael Neuffer <mike@i-Connect.Net>
Cc: "Stephen M. Cameron" <scameron@beardog.cce.hp.com>
Cc: Neela Syam Kolli <megaraidlinux@lsi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8ac41b9d
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -683,14 +683,13 @@ static int twl_allocate_memory(TW_Device_Extension *tw_dev, int size, int which)
	unsigned long *cpu_addr;
	int retval = 1;

	cpu_addr = pci_alloc_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, &dma_handle);
	cpu_addr = pci_zalloc_consistent(tw_dev->tw_pci_dev, size * TW_Q_LENGTH,
					 &dma_handle);
	if (!cpu_addr) {
		TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed");
		goto out;
	}

	memset(cpu_addr, 0, size*TW_Q_LENGTH);

	for (i = 0; i < TW_Q_LENGTH; i++) {
		switch(which) {
		case 0:
+2 −6
Original line number Diff line number Diff line
@@ -1125,23 +1125,19 @@ static int inia100_probe_one(struct pci_dev *pdev,

	/* Get total memory needed for SCB */
	sz = ORC_MAXQUEUE * sizeof(struct orc_scb);
	host->scb_virt = pci_alloc_consistent(pdev, sz,
			&host->scb_phys);
	host->scb_virt = pci_zalloc_consistent(pdev, sz, &host->scb_phys);
	if (!host->scb_virt) {
		printk("inia100: SCB memory allocation error\n");
		goto out_host_put;
	}
	memset(host->scb_virt, 0, sz);

	/* Get total memory needed for ESCB */
	sz = ORC_MAXQUEUE * sizeof(struct orc_extended_scb);
	host->escb_virt = pci_alloc_consistent(pdev, sz,
			&host->escb_phys);
	host->escb_virt = pci_zalloc_consistent(pdev, sz, &host->escb_phys);
	if (!host->escb_virt) {
		printk("inia100: ESCB memory allocation error\n");
		goto out_free_scb_array;
	}
	memset(host->escb_virt, 0, sz);

	biosaddr = host->BIOScfg;
	biosaddr = (biosaddr << 4);
+4 −6
Original line number Diff line number Diff line
@@ -3538,10 +3538,9 @@ static int be_queue_alloc(struct beiscsi_hba *phba, struct be_queue_info *q,
	q->len = len;
	q->entry_size = entry_size;
	mem->size = len * entry_size;
	mem->va = pci_alloc_consistent(phba->pcidev, mem->size, &mem->dma);
	mem->va = pci_zalloc_consistent(phba->pcidev, mem->size, &mem->dma);
	if (!mem->va)
		return -ENOMEM;
	memset(mem->va, 0, mem->size);
	return 0;
}

@@ -4320,7 +4319,7 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
			    "BM_%d : No boot session\n");
		return ret;
	}
	nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,
	nonemb_cmd.va = pci_zalloc_consistent(phba->ctrl.pdev,
					      sizeof(*session_resp),
					      &nonemb_cmd.dma);
	if (nonemb_cmd.va == NULL) {
@@ -4332,7 +4331,6 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
		return -ENOMEM;
	}

	memset(nonemb_cmd.va, 0, sizeof(*session_resp));
	tag = mgmt_get_session_info(phba, s_handle,
				    &nonemb_cmd);
	if (!tag) {
+1 −2
Original line number Diff line number Diff line
@@ -900,13 +900,12 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
static int mgmt_alloc_cmd_data(struct beiscsi_hba *phba, struct be_dma_mem *cmd,
			       int iscsi_cmd, int size)
{
	cmd->va = pci_alloc_consistent(phba->ctrl.pdev, size, &cmd->dma);
	cmd->va = pci_zalloc_consistent(phba->ctrl.pdev, size, &cmd->dma);
	if (!cmd->va) {
		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
			    "BG_%d : Failed to allocate memory for if info\n");
		return -ENOMEM;
	}
	memset(cmd->va, 0, size);
	cmd->size = size;
	be_cmd_hdr_prepare(cmd->va, CMD_SUBSYSTEM_ISCSI, iscsi_cmd, size);
	return 0;
+1 −7
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ csio_wr_alloc_q(struct csio_hw *hw, uint32_t qsize, uint32_t wrsize,

	q = wrm->q_arr[free_idx];

	q->vstart = pci_alloc_consistent(hw->pdev, qsz, &q->pstart);
	q->vstart = pci_zalloc_consistent(hw->pdev, qsz, &q->pstart);
	if (!q->vstart) {
		csio_err(hw,
			 "Failed to allocate DMA memory for "
@@ -240,12 +240,6 @@ csio_wr_alloc_q(struct csio_hw *hw, uint32_t qsize, uint32_t wrsize,
		return -1;
	}

	/*
	 * We need to zero out the contents, importantly for ingress,
	 * since we start with a generatiom bit of 1 for ingress.
	 */
	memset(q->vstart, 0, qsz);

	q->type		= type;
	q->owner	= owner;
	q->pidx		= q->cidx = q->inc_idx = 0;
Loading