scsi: ufs: core: Fix ufshcd_inc_sq_tail function bug
Subsystems (2)
PATCH 1/1 scsi: ufs: core: Fix ufshcd_inc_sq_tail function bug
From: zhanghui <[email protected]>
If q->max_entries is not multiple of 32, mask not every bit is 1. So q->sq_tail_slot some bit will be cleared by use this way.
Signed-off-by zhanghui <[email protected]>
--- drivers/ufs/core/ufshcd-priv.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ufs/core/ufshcd-priv.h +3 -2
@@ -366,10 +366,11 @@ static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info, u8static inline void ufshcd_inc_sq_tail (struct ufs_hw_queue *q) __must_hold(&q->sq_lock) { -u32 mask = q->max_entries -1 ;u32 val; - q->sq_tail_slot = (q->sq_tail_slot +1 ) & mask; + q->sq_tail_slot++; +if (q->sq_tail_slot == q->max_entries) + q->sq_tail_slot =0 ; val = q->sq_tail_slot *sizeof (struct utp_transfer_req_desc );writel (val, q->mcq_sq_tail); }
Signature · 1 line
2.39.0
Quoted 4 lines · Zhang Hui
From: zhanghui <[email protected]>
If
q->max_entriesis not multiple of 32, mask not every bit is 1. Soq->sq_tail_slotsome bit will be cleared by use this way.
Hi Zhang,
Maybe reword the commit message a little bit? Otherwise, it is a good patch.
Reviewed-by Bao D. Nguyen <[email protected]>