Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()

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>

authored by

Chenghai Huang and committed by
Herbert Xu
b74fd80d 50fdb78b

+4 -5
+4 -5
drivers/crypto/hisilicon/qm.c
··· 991 991 return; 992 992 poll_data = &qm->poll_data[cqn]; 993 993 994 - while (QM_EQE_PHASE(dw0) != qm->status.eqc_phase) { 994 + do { 995 995 poll_data->qp_finish_id[eqe_num] = dw0 & QM_EQE_CQN_MASK; 996 996 eqe_num++; 997 997 ··· 1004 1004 qm->status.eq_head++; 1005 1005 } 1006 1006 1007 - if (eqe_num == (eq_depth >> 1) - 1) 1008 - break; 1009 - 1010 1007 dw0 = le32_to_cpu(eqe->dw0); 1011 - } 1008 + if (QM_EQE_PHASE(dw0) != qm->status.eqc_phase) 1009 + break; 1010 + } while (eqe_num < (eq_depth >> 1) - 1); 1012 1011 1013 1012 poll_data->eqe_num = eqe_num; 1014 1013 queue_work(qm->wq, &poll_data->work);