linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Cocci spatch "pool_zalloc-simple" - v5.2-rc1
@ 2019-05-29 20:21 Thomas Meyer
  2019-05-29 20:21 ` [PATCH] scsi: lpfc: Use *_pool_zalloc rather than *_pool_alloc Thomas Meyer
  2019-05-29 20:21 ` [PATCH] scsi: pmcraid: " Thomas Meyer
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Meyer @ 2019-05-29 20:21 UTC (permalink / raw)
  To: linux-kernel

Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0.

Found by coccinelle spatch "api/alloc/pool_zalloc-simple.cocci"

Run against version v5.2-rc1

P.S. If you find this email unwanted, set up a procmail rule junking on
the header:

X-Patch: Cocci

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] scsi: lpfc: Use *_pool_zalloc rather than *_pool_alloc
  2019-05-29 20:21 Cocci spatch "pool_zalloc-simple" - v5.2-rc1 Thomas Meyer
@ 2019-05-29 20:21 ` Thomas Meyer
  2019-05-30  0:23   ` James Smart
  2019-05-30  2:06   ` Martin K. Petersen
  2019-05-29 20:21 ` [PATCH] scsi: pmcraid: " Thomas Meyer
  1 sibling, 2 replies; 7+ messages in thread
From: Thomas Meyer @ 2019-05-29 20:21 UTC (permalink / raw)
  To: james.smart, dick.kennedy, jejb, martin.petersen, linux-scsi,
	linux-kernel

Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -4114,14 +4114,13 @@ lpfc_new_io_buf(struct lpfc_hba *phba, i
 		 * 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);
 
 		/*
 		 * 4K Page alignment is CRITICAL to BlockGuard, double check

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] scsi: pmcraid: Use *_pool_zalloc rather than *_pool_alloc
  2019-05-29 20:21 Cocci spatch "pool_zalloc-simple" - v5.2-rc1 Thomas Meyer
  2019-05-29 20:21 ` [PATCH] scsi: lpfc: Use *_pool_zalloc rather than *_pool_alloc Thomas Meyer
@ 2019-05-29 20:21 ` Thomas Meyer
  2019-11-03 16:05   ` Markus Elfring
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Meyer @ 2019-05-29 20:21 UTC (permalink / raw)
  To: jejb, martin.petersen, linux-scsi, linux-kernel

Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4668,18 +4668,14 @@ static int pmcraid_allocate_control_bloc
 		return -ENOMEM;
 
 	for (i = 0; i < PMCRAID_MAX_CMD; i++) {
-		pinstance->cmd_list[i]->ioa_cb =
-			dma_pool_alloc(
-				pinstance->control_pool,
-				GFP_KERNEL,
-				&(pinstance->cmd_list[i]->ioa_cb_bus_addr));
+		pinstance->cmd_list[i]->ioa_cb = dma_pool_zalloc(pinstance->control_pool,
+								 GFP_KERNEL,
+								 &(pinstance->cmd_list[i]->ioa_cb_bus_addr));
 
 		if (!pinstance->cmd_list[i]->ioa_cb) {
 			pmcraid_release_control_blocks(pinstance, i);
 			return -ENOMEM;
 		}
-		memset(pinstance->cmd_list[i]->ioa_cb, 0,
-			sizeof(struct pmcraid_control_block));
 	}
 	return 0;
 }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] scsi: lpfc: Use *_pool_zalloc rather than *_pool_alloc
  2019-05-29 20:21 ` [PATCH] scsi: lpfc: Use *_pool_zalloc rather than *_pool_alloc Thomas Meyer
@ 2019-05-30  0:23   ` James Smart
  2019-05-30  2:06   ` Martin K. Petersen
  1 sibling, 0 replies; 7+ messages in thread
From: James Smart @ 2019-05-30  0:23 UTC (permalink / raw)
  To: Thomas Meyer, dick.kennedy, jejb, martin.petersen, linux-scsi,
	linux-kernel



On 5/29/2019 1:21 PM, Thomas Meyer wrote:
> Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0.
>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
>
>

looks good

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

-- james


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] scsi: lpfc: Use *_pool_zalloc rather than *_pool_alloc
  2019-05-29 20:21 ` [PATCH] scsi: lpfc: Use *_pool_zalloc rather than *_pool_alloc Thomas Meyer
  2019-05-30  0:23   ` James Smart
@ 2019-05-30  2:06   ` Martin K. Petersen
  1 sibling, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2019-05-30  2:06 UTC (permalink / raw)
  To: Thomas Meyer
  Cc: james.smart, dick.kennedy, jejb, martin.petersen, linux-scsi,
	linux-kernel


Thomas,

> Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0.

Applied to 5.3/scsi-queue. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: scsi: pmcraid: Use *_pool_zalloc rather than *_pool_alloc
  2019-05-29 20:21 ` [PATCH] scsi: pmcraid: " Thomas Meyer
@ 2019-11-03 16:05   ` Markus Elfring
  2019-11-14  8:56     ` Gomonovych, Vasyl
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2019-11-03 16:05 UTC (permalink / raw)
  To: Thomas Meyer, James E. J. Bottomley, Martin K. Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel, Vasyl Gomonovych

> Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0.

Do you find a commit message nicer from a similar change suggestion?
scsi: pmcraid: Use dma_pool_zalloc rather than dma_pool_alloc
https://lore.kernel.org/linux-scsi/20190718181051.22882-1-gomonovych@gmail.com/
https://lore.kernel.org/patchwork/patch/1102040/

Regards,
Markus

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: scsi: pmcraid: Use *_pool_zalloc rather than *_pool_alloc
  2019-11-03 16:05   ` Markus Elfring
@ 2019-11-14  8:56     ` Gomonovych, Vasyl
  0 siblings, 0 replies; 7+ messages in thread
From: Gomonovych, Vasyl @ 2019-11-14  8:56 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Thomas Meyer, James E. J. Bottomley, Martin K. Petersen,
	linux-scsi, kernel-janitors, linux-kernel

Hi,

Yes, maybe you are right better to use the full name, sorry.

Regards Vasyl

On Sun, Nov 3, 2019 at 5:05 PM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> > Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0.
>
> Do you find a commit message nicer from a similar change suggestion?
> scsi: pmcraid: Use dma_pool_zalloc rather than dma_pool_alloc
> https://lore.kernel.org/linux-scsi/20190718181051.22882-1-gomonovych@gmail.com/
> https://lore.kernel.org/patchwork/patch/1102040/
>
> Regards,
> Markus



-- 
Доброї вам пори дня.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-14  8:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 20:21 Cocci spatch "pool_zalloc-simple" - v5.2-rc1 Thomas Meyer
2019-05-29 20:21 ` [PATCH] scsi: lpfc: Use *_pool_zalloc rather than *_pool_alloc Thomas Meyer
2019-05-30  0:23   ` James Smart
2019-05-30  2:06   ` Martin K. Petersen
2019-05-29 20:21 ` [PATCH] scsi: pmcraid: " Thomas Meyer
2019-11-03 16:05   ` Markus Elfring
2019-11-14  8:56     ` Gomonovych, Vasyl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).