mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
nvme: fix command ID wraparound handling
nvme_get_cmd_id() returns 0 after cmdid reaches USHRT_MAX, but fails to reset cmdid itself. As a result, all subsequent calls keep returning 0 indefinitely. Reset cmdid when wraparound occurs so command IDs continue incrementing correctly. Signed-off-by: Prashant Kamble <prashant.kamble223@gmail.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patch.msgid.link/20260518060915.45607-1-prashant.kamble223@gmail.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
This commit is contained in:
committed by
Neil Armstrong
parent
49f8b8de4e
commit
d6eb327828
@@ -112,7 +112,10 @@ static __le16 nvme_get_cmd_id(void)
|
||||
{
|
||||
static unsigned short cmdid;
|
||||
|
||||
return cpu_to_le16((cmdid < USHRT_MAX) ? cmdid++ : 0);
|
||||
if (cmdid >= USHRT_MAX)
|
||||
cmdid = 0;
|
||||
|
||||
return cpu_to_le16(cmdid++);
|
||||
}
|
||||
|
||||
static u16 nvme_read_completion_status(struct nvme_queue *nvmeq, u16 index)
|
||||
|
||||
Reference in New Issue
Block a user