Re: [PATCH 7/9] scsi: bnx2fc: Use zeroing allocator rather than allocator/memset
Himanshu, > scsi: qedi: Use zeroing allocator instead of allocator/memset --Resend > scsi: mvsas: Use zeroing allocator rather than allocator/memset > scsi: fnic: Use zeroing allocator rather than allocator/memset > scsi: dpt_i2o: Use zeroing allocator rather than allocator/memset > scsi: bnx2fc: Use zeroing allocator rather than allocator/memset --Resend > > But do I also need to send those mentioned above, which didn't receive > any response from you ? I typically only merge cleanup patches if the driver maintainer acks them. So you should poke the relevant maintainers. -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 7/9] scsi: bnx2fc: Use zeroing allocator rather than allocator/memset
Hello Martin, On Thu, Jan 04, 2018 at 01:17:52AM -0500, Martin K. Petersen wrote: > > Himanshu, > > > Use dma_zalloc_coherent instead of dma_alloc_coherent followed by > > memset 0. > > Does not apply to 4.16/scsi-queue. Please resubmit. Thanks! No problem, I will resend the patch. scsi: qla4xxx: Use zeroing allocator rather than allocator/memset --Applied scsi: qla2xxx: Use zeroing allocator rather than allocator/memset --Applied scsi: qedi: Use zeroing allocator instead of allocator/memset --Resend scsi: mvsas: Use zeroing allocator rather than allocator/memset scsi: fnic: Use zeroing allocator rather than allocator/memset scsi: dpt_i2o: Use zeroing allocator rather than allocator/memset scsi: bnx2fc: Use zeroing allocator rather than allocator/memset --Resend scsi: bfa: Use zeroing allocator rather than allocator/memset --Applied scsi: bnx2i: Use zeroing allocator rather than allocator/memset --Applied But do I also need to send those mentioned above, which didn't receive any response from you ? Also, I later sent a patch for fnic after this series which can be applied after or before this series whichever is suitable to you. Thanks Himanshu Jha
Re: [PATCH 7/9] scsi: bnx2fc: Use zeroing allocator rather than allocator/memset
Himanshu, > Use dma_zalloc_coherent instead of dma_alloc_coherent followed by > memset 0. Does not apply to 4.16/scsi-queue. Please resubmit. Thanks! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 7/9] scsi: bnx2fc: Use zeroing allocator rather than allocator/memset
On Sat, 30 Dec 2017, 10:28am, Himanshu Jha wrote: > Use dma_zalloc_coherent instead of dma_alloc_coherent followed by > memset 0. > > Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci > > Suggested-by: Luis R. Rodriguez > Signed-off-by: Himanshu Jha > --- > drivers/scsi/bnx2fc/bnx2fc_hwi.c | 60 > +--- > drivers/scsi/bnx2fc/bnx2fc_tgt.c | 51 +++--- > 2 files changed, 47 insertions(+), 64 deletions(-) > > diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c > b/drivers/scsi/bnx2fc/bnx2fc_hwi.c > index 26de61d..e8ae4d6 100644 > --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c > +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c > @@ -1857,16 +1857,15 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba) >* entries. Hence the limit with one page is 8192 task context >* entries. >*/ > - hba->task_ctx_bd_tbl = dma_alloc_coherent(&hba->pcidev->dev, > - PAGE_SIZE, > - &hba->task_ctx_bd_dma, > - GFP_KERNEL); > + hba->task_ctx_bd_tbl = dma_zalloc_coherent(&hba->pcidev->dev, > +PAGE_SIZE, > +&hba->task_ctx_bd_dma, > +GFP_KERNEL); > if (!hba->task_ctx_bd_tbl) { > printk(KERN_ERR PFX "unable to allocate task context BDT\n"); > rc = -1; > goto out; > } > - memset(hba->task_ctx_bd_tbl, 0, PAGE_SIZE); > > /* >* Allocate task_ctx which is an array of pointers pointing to > @@ -1895,16 +1894,15 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba) > task_ctx_bdt = (struct regpair *)hba->task_ctx_bd_tbl; > for (i = 0; i < task_ctx_arr_sz; i++) { > > - hba->task_ctx[i] = dma_alloc_coherent(&hba->pcidev->dev, > - PAGE_SIZE, > - &hba->task_ctx_dma[i], > - GFP_KERNEL); > + hba->task_ctx[i] = dma_zalloc_coherent(&hba->pcidev->dev, > +PAGE_SIZE, > +&hba->task_ctx_dma[i], > +GFP_KERNEL); > if (!hba->task_ctx[i]) { > printk(KERN_ERR PFX "unable to alloc task context\n"); > rc = -1; > goto out3; > } > - memset(hba->task_ctx[i], 0, PAGE_SIZE); > addr = (u64)hba->task_ctx_dma[i]; > task_ctx_bdt->hi = cpu_to_le32((u64)addr >> 32); > task_ctx_bdt->lo = cpu_to_le32((u32)addr); > @@ -2033,28 +2031,23 @@ static int bnx2fc_allocate_hash_table(struct > bnx2fc_hba *hba) > } > > for (i = 0; i < segment_count; ++i) { > - hba->hash_tbl_segments[i] = > - dma_alloc_coherent(&hba->pcidev->dev, > -BNX2FC_HASH_TBL_CHUNK_SIZE, > -&dma_segment_array[i], > -GFP_KERNEL); > + hba->hash_tbl_segments[i] = > + dma_zalloc_coherent(&hba->pcidev->dev, > + BNX2FC_HASH_TBL_CHUNK_SIZE, > + &dma_segment_array[i], > + GFP_KERNEL); > if (!hba->hash_tbl_segments[i]) { > printk(KERN_ERR PFX "hash segment alloc failed\n"); > goto cleanup_dma; > } > - memset(hba->hash_tbl_segments[i], 0, > -BNX2FC_HASH_TBL_CHUNK_SIZE); > } > > - hba->hash_tbl_pbl = dma_alloc_coherent(&hba->pcidev->dev, > -PAGE_SIZE, > -&hba->hash_tbl_pbl_dma, > -GFP_KERNEL); > + hba->hash_tbl_pbl = dma_zalloc_coherent(&hba->pcidev->dev, PAGE_SIZE, > + &hba->hash_tbl_pbl_dma, > + GFP_KERNEL); > if (!hba->hash_tbl_pbl) { > printk(KERN_ERR PFX "hash table pbl alloc failed\n"); > goto cleanup_dma; > } > - memset(hba->hash_tbl_pbl, 0, PAGE_SIZE); > > pbl = hba->hash_tbl_pbl; > for (i = 0; i < segment_count; ++i) { > @@ -2111,27 +2104,26 @@ int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba) > return -ENOMEM; > > mem_size = BNX2FC_NUM_MAX_SESS * sizeof(struct regpair); > - hba->t2_hash_tbl_ptr = dma_alloc_coherent(&hba->pcidev->dev, mem_size, > -
[PATCH 7/9] scsi: bnx2fc: Use zeroing allocator rather than allocator/memset
Use dma_zalloc_coherent instead of dma_alloc_coherent followed by memset 0. Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci Suggested-by: Luis R. Rodriguez Signed-off-by: Himanshu Jha --- drivers/scsi/bnx2fc/bnx2fc_hwi.c | 60 +--- drivers/scsi/bnx2fc/bnx2fc_tgt.c | 51 +++--- 2 files changed, 47 insertions(+), 64 deletions(-) diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c index 26de61d..e8ae4d6 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c @@ -1857,16 +1857,15 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba) * entries. Hence the limit with one page is 8192 task context * entries. */ - hba->task_ctx_bd_tbl = dma_alloc_coherent(&hba->pcidev->dev, - PAGE_SIZE, - &hba->task_ctx_bd_dma, - GFP_KERNEL); + hba->task_ctx_bd_tbl = dma_zalloc_coherent(&hba->pcidev->dev, + PAGE_SIZE, + &hba->task_ctx_bd_dma, + GFP_KERNEL); if (!hba->task_ctx_bd_tbl) { printk(KERN_ERR PFX "unable to allocate task context BDT\n"); rc = -1; goto out; } - memset(hba->task_ctx_bd_tbl, 0, PAGE_SIZE); /* * Allocate task_ctx which is an array of pointers pointing to @@ -1895,16 +1894,15 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba) task_ctx_bdt = (struct regpair *)hba->task_ctx_bd_tbl; for (i = 0; i < task_ctx_arr_sz; i++) { - hba->task_ctx[i] = dma_alloc_coherent(&hba->pcidev->dev, - PAGE_SIZE, - &hba->task_ctx_dma[i], - GFP_KERNEL); + hba->task_ctx[i] = dma_zalloc_coherent(&hba->pcidev->dev, + PAGE_SIZE, + &hba->task_ctx_dma[i], + GFP_KERNEL); if (!hba->task_ctx[i]) { printk(KERN_ERR PFX "unable to alloc task context\n"); rc = -1; goto out3; } - memset(hba->task_ctx[i], 0, PAGE_SIZE); addr = (u64)hba->task_ctx_dma[i]; task_ctx_bdt->hi = cpu_to_le32((u64)addr >> 32); task_ctx_bdt->lo = cpu_to_le32((u32)addr); @@ -2033,28 +2031,23 @@ static int bnx2fc_allocate_hash_table(struct bnx2fc_hba *hba) } for (i = 0; i < segment_count; ++i) { - hba->hash_tbl_segments[i] = - dma_alloc_coherent(&hba->pcidev->dev, - BNX2FC_HASH_TBL_CHUNK_SIZE, - &dma_segment_array[i], - GFP_KERNEL); + hba->hash_tbl_segments[i] = +dma_zalloc_coherent(&hba->pcidev->dev, + BNX2FC_HASH_TBL_CHUNK_SIZE, + &dma_segment_array[i], + GFP_KERNEL); if (!hba->hash_tbl_segments[i]) { printk(KERN_ERR PFX "hash segment alloc failed\n"); goto cleanup_dma; } - memset(hba->hash_tbl_segments[i], 0, - BNX2FC_HASH_TBL_CHUNK_SIZE); } - hba->hash_tbl_pbl = dma_alloc_coherent(&hba->pcidev->dev, - PAGE_SIZE, - &hba->hash_tbl_pbl_dma, - GFP_KERNEL); + hba->hash_tbl_pbl = dma_zalloc_coherent(&hba->pcidev->dev, PAGE_SIZE, + &hba->hash_tbl_pbl_dma, + GFP_KERNEL); if (!hba->hash_tbl_pbl) { printk(KERN_ERR PFX "hash table pbl alloc failed\n"); goto cleanup_dma; } - memset(hba->hash_tbl_pbl, 0, PAGE_SIZE); pbl = hba->hash_tbl_pbl; for (i = 0; i < segment_count; ++i) { @@ -2111,27 +2104,26 @@ int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba) return -ENOMEM; mem_size = BNX2FC_NUM_MAX_SESS * sizeof(struct regpair); - hba->t2_hash_tbl_ptr = dma_alloc_coherent(&hba->pcidev->dev, mem_size, - &hba->t2_hash_tbl_ptr_dma, -