scsi: lpfc: Cocci spatch "pool_zalloc-simple"
authorThomas Meyer <thomas@m3y3r.de>
Thu, 21 Sep 2017 06:15:26 +0000 (08:15 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 25 Sep 2017 23:05:38 +0000 (19:05 -0400)
Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0.
Found by coccinelle spatch "api/alloc/pool_zalloc-simple.cocci"

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_nvme.c

index 79ba3ce063a4f847ce8187d3290ecf5a309f62b9..d7cb6ba7189294fa8578b73df034dc95301d46af 100644 (file)
@@ -1938,14 +1938,13 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc)
                 * pci bus space for an I/O. The DMA buffer includes the
                 * number of SGE's necessary to support the sg_tablesize.
                 */
-               lpfc_ncmd->data = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool,
-                                                GFP_KERNEL,
-                                                &lpfc_ncmd->dma_handle);
+               lpfc_ncmd->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
+                                                 GFP_KERNEL,
+                                                 &lpfc_ncmd->dma_handle);
                if (!lpfc_ncmd->data) {
                        kfree(lpfc_ncmd);
                        break;
                }
-               memset(lpfc_ncmd->data, 0, phba->cfg_sg_dma_buf_size);
 
                lxri = lpfc_sli4_next_xritag(phba);
                if (lxri == NO_XRI) {