mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-10 07:50:04 +00:00
block: use pci_zalloc_consistent
Remove the now unnecessary memset too. Signed-off-by: Joe Perches <joe@perches.com> Mike Miller <mike.miller@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
6f2a011afc
commit
a5bbf6160c
@ -6741,11 +6741,11 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request,
|
|||||||
ErrorCode = -ENOMEM;
|
ErrorCode = -ENOMEM;
|
||||||
if (DataTransferLength > 0)
|
if (DataTransferLength > 0)
|
||||||
{
|
{
|
||||||
DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
|
DataTransferBuffer = pci_zalloc_consistent(Controller->PCIDevice,
|
||||||
DataTransferLength, &DataTransferBufferDMA);
|
DataTransferLength,
|
||||||
|
&DataTransferBufferDMA);
|
||||||
if (DataTransferBuffer == NULL)
|
if (DataTransferBuffer == NULL)
|
||||||
break;
|
break;
|
||||||
memset(DataTransferBuffer, 0, DataTransferLength);
|
|
||||||
}
|
}
|
||||||
else if (DataTransferLength < 0)
|
else if (DataTransferLength < 0)
|
||||||
{
|
{
|
||||||
@ -6877,11 +6877,11 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request,
|
|||||||
ErrorCode = -ENOMEM;
|
ErrorCode = -ENOMEM;
|
||||||
if (DataTransferLength > 0)
|
if (DataTransferLength > 0)
|
||||||
{
|
{
|
||||||
DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
|
DataTransferBuffer = pci_zalloc_consistent(Controller->PCIDevice,
|
||||||
DataTransferLength, &DataTransferBufferDMA);
|
DataTransferLength,
|
||||||
|
&DataTransferBufferDMA);
|
||||||
if (DataTransferBuffer == NULL)
|
if (DataTransferBuffer == NULL)
|
||||||
break;
|
break;
|
||||||
memset(DataTransferBuffer, 0, DataTransferLength);
|
|
||||||
}
|
}
|
||||||
else if (DataTransferLength < 0)
|
else if (DataTransferLength < 0)
|
||||||
{
|
{
|
||||||
@ -6899,14 +6899,14 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request,
|
|||||||
RequestSenseLength = UserCommand.RequestSenseLength;
|
RequestSenseLength = UserCommand.RequestSenseLength;
|
||||||
if (RequestSenseLength > 0)
|
if (RequestSenseLength > 0)
|
||||||
{
|
{
|
||||||
RequestSenseBuffer = pci_alloc_consistent(Controller->PCIDevice,
|
RequestSenseBuffer = pci_zalloc_consistent(Controller->PCIDevice,
|
||||||
RequestSenseLength, &RequestSenseBufferDMA);
|
RequestSenseLength,
|
||||||
|
&RequestSenseBufferDMA);
|
||||||
if (RequestSenseBuffer == NULL)
|
if (RequestSenseBuffer == NULL)
|
||||||
{
|
{
|
||||||
ErrorCode = -ENOMEM;
|
ErrorCode = -ENOMEM;
|
||||||
goto Failure2;
|
goto Failure2;
|
||||||
}
|
}
|
||||||
memset(RequestSenseBuffer, 0, RequestSenseLength);
|
|
||||||
}
|
}
|
||||||
spin_lock_irqsave(&Controller->queue_lock, flags);
|
spin_lock_irqsave(&Controller->queue_lock, flags);
|
||||||
while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
|
while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
|
||||||
|
@ -1014,24 +1014,21 @@ static CommandList_struct *cmd_special_alloc(ctlr_info_t *h)
|
|||||||
u64bit temp64;
|
u64bit temp64;
|
||||||
dma_addr_t cmd_dma_handle, err_dma_handle;
|
dma_addr_t cmd_dma_handle, err_dma_handle;
|
||||||
|
|
||||||
c = (CommandList_struct *) pci_alloc_consistent(h->pdev,
|
c = pci_zalloc_consistent(h->pdev, sizeof(CommandList_struct),
|
||||||
sizeof(CommandList_struct), &cmd_dma_handle);
|
&cmd_dma_handle);
|
||||||
if (c == NULL)
|
if (c == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
memset(c, 0, sizeof(CommandList_struct));
|
|
||||||
|
|
||||||
c->cmdindex = -1;
|
c->cmdindex = -1;
|
||||||
|
|
||||||
c->err_info = (ErrorInfo_struct *)
|
c->err_info = pci_zalloc_consistent(h->pdev, sizeof(ErrorInfo_struct),
|
||||||
pci_alloc_consistent(h->pdev, sizeof(ErrorInfo_struct),
|
&err_dma_handle);
|
||||||
&err_dma_handle);
|
|
||||||
|
|
||||||
if (c->err_info == NULL) {
|
if (c->err_info == NULL) {
|
||||||
pci_free_consistent(h->pdev,
|
pci_free_consistent(h->pdev,
|
||||||
sizeof(CommandList_struct), c, cmd_dma_handle);
|
sizeof(CommandList_struct), c, cmd_dma_handle);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(c->err_info, 0, sizeof(ErrorInfo_struct));
|
|
||||||
|
|
||||||
INIT_LIST_HEAD(&c->list);
|
INIT_LIST_HEAD(&c->list);
|
||||||
c->busaddr = (__u32) cmd_dma_handle;
|
c->busaddr = (__u32) cmd_dma_handle;
|
||||||
|
@ -4112,16 +4112,14 @@ static int skd_cons_skcomp(struct skd_device *skdev)
|
|||||||
skdev->name, __func__, __LINE__,
|
skdev->name, __func__, __LINE__,
|
||||||
nbytes, SKD_N_COMPLETION_ENTRY);
|
nbytes, SKD_N_COMPLETION_ENTRY);
|
||||||
|
|
||||||
skcomp = pci_alloc_consistent(skdev->pdev, nbytes,
|
skcomp = pci_zalloc_consistent(skdev->pdev, nbytes,
|
||||||
&skdev->cq_dma_address);
|
&skdev->cq_dma_address);
|
||||||
|
|
||||||
if (skcomp == NULL) {
|
if (skcomp == NULL) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(skcomp, 0, nbytes);
|
|
||||||
|
|
||||||
skdev->skcomp_table = skcomp;
|
skdev->skcomp_table = skcomp;
|
||||||
skdev->skerr_table = (struct fit_comp_error_info *)((char *)skcomp +
|
skdev->skerr_table = (struct fit_comp_error_info *)((char *)skcomp +
|
||||||
sizeof(*skcomp) *
|
sizeof(*skcomp) *
|
||||||
@ -4304,15 +4302,14 @@ static int skd_cons_skspcl(struct skd_device *skdev)
|
|||||||
|
|
||||||
nbytes = SKD_N_SPECIAL_FITMSG_BYTES;
|
nbytes = SKD_N_SPECIAL_FITMSG_BYTES;
|
||||||
|
|
||||||
skspcl->msg_buf = pci_alloc_consistent(skdev->pdev, nbytes,
|
skspcl->msg_buf =
|
||||||
&skspcl->mb_dma_address);
|
pci_zalloc_consistent(skdev->pdev, nbytes,
|
||||||
|
&skspcl->mb_dma_address);
|
||||||
if (skspcl->msg_buf == NULL) {
|
if (skspcl->msg_buf == NULL) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(skspcl->msg_buf, 0, nbytes);
|
|
||||||
|
|
||||||
skspcl->req.sg = kzalloc(sizeof(struct scatterlist) *
|
skspcl->req.sg = kzalloc(sizeof(struct scatterlist) *
|
||||||
SKD_N_SG_PER_SPECIAL, GFP_KERNEL);
|
SKD_N_SG_PER_SPECIAL, GFP_KERNEL);
|
||||||
if (skspcl->req.sg == NULL) {
|
if (skspcl->req.sg == NULL) {
|
||||||
@ -4353,25 +4350,21 @@ static int skd_cons_sksb(struct skd_device *skdev)
|
|||||||
|
|
||||||
nbytes = SKD_N_INTERNAL_BYTES;
|
nbytes = SKD_N_INTERNAL_BYTES;
|
||||||
|
|
||||||
skspcl->data_buf = pci_alloc_consistent(skdev->pdev, nbytes,
|
skspcl->data_buf = pci_zalloc_consistent(skdev->pdev, nbytes,
|
||||||
&skspcl->db_dma_address);
|
&skspcl->db_dma_address);
|
||||||
if (skspcl->data_buf == NULL) {
|
if (skspcl->data_buf == NULL) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(skspcl->data_buf, 0, nbytes);
|
|
||||||
|
|
||||||
nbytes = SKD_N_SPECIAL_FITMSG_BYTES;
|
nbytes = SKD_N_SPECIAL_FITMSG_BYTES;
|
||||||
skspcl->msg_buf = pci_alloc_consistent(skdev->pdev, nbytes,
|
skspcl->msg_buf = pci_zalloc_consistent(skdev->pdev, nbytes,
|
||||||
&skspcl->mb_dma_address);
|
&skspcl->mb_dma_address);
|
||||||
if (skspcl->msg_buf == NULL) {
|
if (skspcl->msg_buf == NULL) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(skspcl->msg_buf, 0, nbytes);
|
|
||||||
|
|
||||||
skspcl->req.sksg_list = skd_cons_sg_list(skdev, 1,
|
skspcl->req.sksg_list = skd_cons_sg_list(skdev, 1,
|
||||||
&skspcl->req.sksg_dma_address);
|
&skspcl->req.sksg_dma_address);
|
||||||
if (skspcl->req.sksg_list == NULL) {
|
if (skspcl->req.sksg_list == NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user