Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1736389 > unrolled thread

[PATCH 3/6] scsi: lpfc: Cocci spatch "pool_zalloc-simple"

Started byThomas Meyer <thomas@m3y3r.de>
First post2017-09-21 08:30 +0200
Last post2017-09-26 01:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/6] scsi: lpfc: Cocci spatch "pool_zalloc-simple" Thomas Meyer <thomas@m3y3r.de> - 2017-09-21 08:30 +0200
    Re: [PATCH 3/6] scsi: lpfc: Cocci spatch "pool_zalloc-simple" James Smart <james.smart@broadcom.com> - 2017-09-22 17:30 +0200
    Re: [PATCH 3/6] scsi: lpfc: Cocci spatch "pool_zalloc-simple" "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-09-26 01:10 +0200

#1736389 — [PATCH 3/6] scsi: lpfc: Cocci spatch "pool_zalloc-simple"

FromThomas Meyer <thomas@m3y3r.de>
Date2017-09-21 08:30 +0200
Subject[PATCH 3/6] scsi: lpfc: Cocci spatch "pool_zalloc-simple"
Message-ID<us39M-5A5-17@gated-at.bofh.it>
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>
---

diff -u -p a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -1938,14 +1938,13 @@ lpfc_new_nvme_buf(struct lpfc_vport *vpo
 		 * 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) {

[toc] | [next] | [standalone]


#1737582

FromJames Smart <james.smart@broadcom.com>
Date2017-09-22 17:30 +0200
Message-ID<usy3T-7Hh-19@gated-at.bofh.it>
In reply to#1736389
On 9/20/2017 11:15 PM, Thomas Meyer wrote:
> 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>
> ---
>
>

Looks good. Thanks.

Signed-off-by: James Smart <james.smart@broadcom.com>

[toc] | [prev] | [next] | [standalone]


#1739329

From"Martin K. Petersen" <martin.petersen@oracle.com>
Date2017-09-26 01:10 +0200
Message-ID<utKFI-4Hh-15@gated-at.bofh.it>
In reply to#1736389
Thomas,

> Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0.
> Found by coccinelle spatch "api/alloc/pool_zalloc-simple.cocci"

Applied to 4.15/scsi-queue. Thank you!

-- 
Martin K. Petersen	Oracle Linux Engineering

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web