Skip to contentSkip to conversation

scsi/lpfc/lpfc_sli.c: Use dma_zalloc_coherent

PATCH Applied Sabyasachi Gupta 4 participants 6 messages Nov 18, 2018 – Nov 22, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi/lpfc/lpfc_sli.c: Use dma_zalloc_coherent

Replaced dma_alloc_coherent + memset with dma_zalloc_coherent

---
 drivers/scsi/lpfc/lpfc_sli.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +1 -2
index 783a154..3491ff7 100644
@@ -6229,7 +6229,7 @@ lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba,
 			goto free_mem;
 		}
 
-		dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev,
+		dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev,
 						  LPFC_RAS_MAX_ENTRY_SIZE,
 						  &dmabuf->phys,
 						  GFP_KERNEL);
@@ -6240,7 +6240,6 @@ lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba,
 					"6187 DMA Alloc Failed FW logging");
 			goto free_mem;
 		}
-		memset(dmabuf->virt, 0, LPFC_RAS_MAX_ENTRY_SIZE);
 		dmabuf->buffer_tag = i;
 		list_add_tail(&dmabuf->list, &ras_fwlog->fwlog_buff_list);
 	}
Signature · 1 line
2.7.4
#1 lore raw
Quoted 12 lines · Sabyasachi Gupta

Replaced dma_alloc_coherent + memset with dma_zalloc_coherent

---
 drivers/scsi/lpfc/lpfc_sli.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +0 -0
index 783a154..3491ff7 100644

drivers/scsi/lpfc/lpfc_sli.c lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba, · line 6233

Quoted 6 lines
drivers/scsi/lpfc/lpfc_sli.c +1 -1
@@ -6229,7 +6229,7 @@ lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba,
 			goto free_mem;
 		}
 
-		dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev,
+		dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev,
 						  LPFC_RAS_MAX_ENTRY_SIZE,

please ensure that you maintain alignment with opening brackets

Quoted 11 lines
drivers/scsi/lpfc/lpfc_sli.c +0 -1
 						  &dmabuf->phys,
 						  GFP_KERNEL);
@@ -6240,7 +6240,6 @@ lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba,
 					"6187 DMA Alloc Failed FW logging");
 			goto free_mem;
 		}
-		memset(dmabuf->virt, 0, LPFC_RAS_MAX_ENTRY_SIZE);
 		dmabuf->buffer_tag = i;
 		list_add_tail(&dmabuf->list, &ras_fwlog->fwlog_buff_list);
 	}
#2 lore raw
Quoted 2 lines · John Garry

please ensure that you maintain alignment with opening brackets

I don't think this is a requirement.  From the rules I've read preference is tabs-only indentation.  Spacing (less than a tab), after tabs, for open brace alignment is allowed, thus is coder's choice.

-- james

#3 lore raw
Quoted 6 lines · James Smart
Quoted 2 lines · John Garry

please ensure that you maintain alignment with opening brackets

I don't think this is a requirement. From the rules I've read preference is tabs-only indentation.

This is the only rule (enforcement) I see:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20181120&id=d1fe9c099cecc6e49324355f1b15573e9dbbe0f9

Spacing (less than a tab), after

Quoted 1 line

tabs, for open brace alignment is allowed, thus is coder's choice.

It seems that alignment was being implemented with tab+space, and now it would be tab+space but no alignment.

cheers,
John

Quoted 9 lines

-- james

Reviewed-by on v1 1/1
#4 lore raw
In reply to Sabyasachi Gupta
Quoted 21 lines · Sabyasachi Gupta

Replaced dma_alloc_coherent + memset with dma_zalloc_coherent

---
  drivers/scsi/lpfc/lpfc_sli.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +1 -1
index 783a154..3491ff7 100644
@@ -6229,7 +6229,7 @@ lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba,
  			goto free_mem;
  		}
 
-		dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev,
+		dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev,
  						  LPFC_RAS_MAX_ENTRY_SIZE,
  						  &dmabuf->phys,
  						  GFP_KERNEL);

drivers/scsi/lpfc/lpfc_sli.c lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba, · line 6245

Quoted 7 lines
drivers/scsi/lpfc/lpfc_sli.c +0 -1
@@ -6240,7 +6240,6 @@ lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba,
  					"6187 DMA Alloc Failed FW logging");
  			goto free_mem;
  		}
-		memset(dmabuf->virt, 0, LPFC_RAS_MAX_ENTRY_SIZE);
  		dmabuf->buffer_tag = i;
  		list_add_tail(&dmabuf->list, &ras_fwlog->fwlog_buff_list);
  	}

Looks fine.

-- james