scsi: ufs: mcq: Fix the search/wrap around logic
authorBao D. Nguyen <quic_nguyenb@quicinc.com>
Wed, 16 Aug 2023 01:38:29 +0000 (18:38 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 21 Aug 2023 21:19:02 +0000 (17:19 -0400)
commitd0c89af3130eb4ff962266bb7597690a696f1cbc
treee9b284b111cef4f5a8271b939451b3f7791b5789
parentef222f551e7c4e2008fc442ffc9edcd1a7fd8f63
scsi: ufs: mcq: Fix the search/wrap around logic

The search and wrap around logic in the ufshcd_mcq_sqe_search() function
does not work correctly when the hwq's queue depth is not a power of two
number. Correct it so that any queue depth with a positive integer value
within the supported range would work.

Signed-off-by: "Bao D. Nguyen" <quic_nguyenb@quicinc.com>
Link: https://lore.kernel.org/r/ff49c15be205135ed3ec186f3086694c02867dbd.1692149603.git.quic_nguyenb@quicinc.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Fixes: 8d7290348992 ("scsi: ufs: mcq: Add supporting functions for MCQ abort")
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufs-mcq.c