scsi: lpfc: Use sg_dma_len() API to get struct scatterlist's length
The sg_dma_len() API should be used to retrieve a scatterlist's length instead of directly accessing scatterlist->length. Signed-off-by: Justin Tee <justin.tee@broadcom.com> Link: https://lore.kernel.org/r/20240131185112.149731-4-justintee8345@gmail.com Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
2ae917d4bc
commit
aa7674bd8d
@ -2728,14 +2728,14 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
|
|||||||
sgde = scsi_sglist(cmd);
|
sgde = scsi_sglist(cmd);
|
||||||
blksize = scsi_prot_interval(cmd);
|
blksize = scsi_prot_interval(cmd);
|
||||||
data_src = (uint8_t *)sg_virt(sgde);
|
data_src = (uint8_t *)sg_virt(sgde);
|
||||||
data_len = sgde->length;
|
data_len = sg_dma_len(sgde);
|
||||||
if ((data_len & (blksize - 1)) == 0)
|
if ((data_len & (blksize - 1)) == 0)
|
||||||
chk_guard = 1;
|
chk_guard = 1;
|
||||||
|
|
||||||
src = (struct scsi_dif_tuple *)sg_virt(sgpe);
|
src = (struct scsi_dif_tuple *)sg_virt(sgpe);
|
||||||
start_ref_tag = scsi_prot_ref_tag(cmd);
|
start_ref_tag = scsi_prot_ref_tag(cmd);
|
||||||
start_app_tag = src->app_tag;
|
start_app_tag = src->app_tag;
|
||||||
len = sgpe->length;
|
len = sg_dma_len(sgpe);
|
||||||
while (src && protsegcnt) {
|
while (src && protsegcnt) {
|
||||||
while (len) {
|
while (len) {
|
||||||
|
|
||||||
@ -2800,7 +2800,7 @@ skipit:
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
data_src = (uint8_t *)sg_virt(sgde);
|
data_src = (uint8_t *)sg_virt(sgde);
|
||||||
data_len = sgde->length;
|
data_len = sg_dma_len(sgde);
|
||||||
if ((data_len & (blksize - 1)) == 0)
|
if ((data_len & (blksize - 1)) == 0)
|
||||||
chk_guard = 1;
|
chk_guard = 1;
|
||||||
}
|
}
|
||||||
@ -2810,7 +2810,7 @@ skipit:
|
|||||||
sgpe = sg_next(sgpe);
|
sgpe = sg_next(sgpe);
|
||||||
if (sgpe) {
|
if (sgpe) {
|
||||||
src = (struct scsi_dif_tuple *)sg_virt(sgpe);
|
src = (struct scsi_dif_tuple *)sg_virt(sgpe);
|
||||||
len = sgpe->length;
|
len = sg_dma_len(sgpe);
|
||||||
} else {
|
} else {
|
||||||
src = NULL;
|
src = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user