]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()
authorChenghai Huang <huangchenghai2@huawei.com>
Thu, 20 Nov 2025 13:21:24 +0000 (21:21 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 19 Dec 2025 06:47:46 +0000 (14:47 +0800)
In qm_get_complete_eqe_num(), the function entry has already
checked whether the interrupt is valid, so the interrupt event
can be processed directly. Currently, the interrupt valid bit is
being checked again redundantly, and no interrupt processing is
performed. Therefore, the loop condition should be modified to
directly process the interrupt event, and use do while instead of
the current while loop, because the condition is always satisfied
on the first iteration.

Fixes: f5a332980a68 ("crypto: hisilicon/qm - add the save operation of eqe and aeqe")
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/qm.c

index f8bfff5dd0bdead6de398f9919dce9d1ae9d377d..d47bf06a90f7d3b723f2b94c3a02679c7dd215a2 100644 (file)
@@ -991,7 +991,7 @@ static void qm_get_complete_eqe_num(struct hisi_qm *qm)
                return;
        poll_data = &qm->poll_data[cqn];
 
-       while (QM_EQE_PHASE(dw0) != qm->status.eqc_phase) {
+       do {
                poll_data->qp_finish_id[eqe_num] = dw0 & QM_EQE_CQN_MASK;
                eqe_num++;
 
@@ -1004,11 +1004,10 @@ static void qm_get_complete_eqe_num(struct hisi_qm *qm)
                        qm->status.eq_head++;
                }
 
-               if (eqe_num == (eq_depth >> 1) - 1)
-                       break;
-
                dw0 = le32_to_cpu(eqe->dw0);
-       }
+               if (QM_EQE_PHASE(dw0) != qm->status.eqc_phase)
+                       break;
+       } while (eqe_num < (eq_depth >> 1) - 1);
 
        poll_data->eqe_num = eqe_num;
        queue_work(qm->wq, &poll_data->work);