提交 fc71ef55 编写于 作者: J JiangShui Yang 提交者: JiangShui

crypto: hisilicon/qm: modify loop exit condition

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7DUYJ
CVE: NA

----------------------------------------------------------------------

Loop branch using 'i++' as condition will cause the loop to not execute
when 'i == 0', should use '++i', Fix it.

Fixes: 26f2f10d ("crypto: hisilicon/qm - obtain the mailbox
configuration at one time")
Fixes: aabdf15d ("vfio/migration: obtain the mailbox configuration at one
time")
Signed-off-by: NJiangShui Yang <yangjiangshui@h-partners.com>
Signed-off-by: NWeili Qian <qianweili@huawei.com>
上级 79f501a5
......@@ -104,7 +104,7 @@ static int qm_wait_mb_finish(struct hisi_qm *qm, struct qm_mailbox *mailbox)
{
int i = 0;
while (i++) {
while (++i) {
qm_mb_read(qm, mailbox);
if (!((le16_to_cpu(mailbox->w0) >> QM_MB_BUSY_SHIFT) & 0x1))
break;
......
......@@ -666,7 +666,7 @@ static int qm_wait_mb_finish(struct hisi_qm *qm, struct qm_mailbox *mailbox)
{
int i = 0;
while (i++) {
while (++i) {
qm_mb_read(qm, mailbox);
if (!((le16_to_cpu(mailbox->w0) >> QM_MB_BUSY_SHIFT) & 0x1))
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册