Skip to content

Commit 663d0c1

Browse files
quic-ziqichenmartinkpetersen
authored andcommitted
scsi: ufs: qcom: Check gear against max gear in vop freq_to_gear()
The vop freq_to_gear() may return a gear greater than the negotiated max gear. Return the negotiated max gear if the mapped gear is greater. Fixes: c02fe9e ("scsi: ufs: qcom: Implement the freq_to_gear_speed() vop") Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> Link: https://lore.kernel.org/r/20250522021537.999107-2-quic_ziqichen@quicinc.com Reported-by: Neil Armstrong <neil.armstrong@linaro.org> Closes: https://lore.kernel.org/all/c7f2476a-943a-4d73-ad80-802c91e5f880@linaro.org/ Tested-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Bean Huo <beanhuo@micron.com> Tested-by: Loïc Minier <loic.minier@oss.qualcomm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 0ae9926 commit 663d0c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/ufs/host/ufs-qcom.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,7 @@ static int ufs_qcom_config_esi(struct ufs_hba *hba)
20832083

20842084
static u32 ufs_qcom_freq_to_gear_speed(struct ufs_hba *hba, unsigned long freq)
20852085
{
2086-
u32 gear = 0;
2086+
u32 gear = UFS_HS_DONT_CHANGE;
20872087

20882088
switch (freq) {
20892089
case 403000000:
@@ -2105,10 +2105,10 @@ static u32 ufs_qcom_freq_to_gear_speed(struct ufs_hba *hba, unsigned long freq)
21052105
break;
21062106
default:
21072107
dev_err(hba->dev, "%s: Unsupported clock freq : %lu\n", __func__, freq);
2108-
break;
2108+
return UFS_HS_DONT_CHANGE;
21092109
}
21102110

2111-
return gear;
2111+
return min_t(u32, gear, hba->max_pwr_info.info.gear_rx);
21122112
}
21132113

21142114
/*

0 commit comments

Comments
 (0)