Skip to content

Commit 5149452

Browse files
powen-kao-mtkmartinkpetersen
authored andcommitted
scsi: ufs: core: Fix MCQ tag calculation
The transfer command descriptor is allocated in ufshcd_memory_alloc() and referenced by the transfer request descriptor with stride size sizeof_utp_transfer_cmd_desc() instead of sizeof(struct utp_transfer_cmd_desc). Consequently, computing tag by address offset should also refer to the same stride. Signed-off-by: Po-Wen Kao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Reviewed-by: Ziqi Chen <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 1a7edd0 commit 5149452

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/ufs/core/ufs-mcq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static int ufshcd_mcq_get_tag(struct ufs_hba *hba,
265265
addr = (le64_to_cpu(cqe->command_desc_base_addr) & CQE_UCD_BA) -
266266
hba->ucdl_dma_addr;
267267

268-
return div_u64(addr, sizeof(struct utp_transfer_cmd_desc));
268+
return div_u64(addr, sizeof_utp_transfer_cmd_desc(hba));
269269
}
270270

271271
static void ufshcd_mcq_process_cqe(struct ufs_hba *hba,

drivers/ufs/core/ufshcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8452,7 +8452,7 @@ static void ufshcd_release_sdb_queue(struct ufs_hba *hba, int nutrs)
84528452
{
84538453
size_t ucdl_size, utrdl_size;
84548454

8455-
ucdl_size = sizeof(struct utp_transfer_cmd_desc) * nutrs;
8455+
ucdl_size = sizeof_utp_transfer_cmd_desc(hba) * nutrs;
84568456
dmam_free_coherent(hba->dev, ucdl_size, hba->ucdl_base_addr,
84578457
hba->ucdl_dma_addr);
84588458

0 commit comments

Comments
 (0)