diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c index 3dde20991569333f2941ae0319759d481f1ccac5..0514f71312c94a4854bb550293e9e63186c6aac8 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_main.c +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c @@ -475,15 +475,18 @@ static int current_qm_write(struct hpre_debugfs_file *file, u32 val) if (val > ctrl->num_vfs) return -EINVAL; - /* According PF or VF Dev ID to calculation the curr_qm_qp_num */ - vfq_num = (qm->ctrl_q_num - qm->qp_num) / ctrl->num_vfs; + /* According PF or VF Dev ID to calculation curr_qm_qp_num and store */ if (val == 0) { qm->debug.curr_qm_qp_num = qm->qp_num; - } else if (val == ctrl->num_vfs) { - qm->debug.curr_qm_qp_num = qm->ctrl_q_num - qm->qp_num - - (ctrl->num_vfs - 1) * vfq_num; } else { - qm->debug.curr_qm_qp_num = vfq_num; + vfq_num = (qm->ctrl_q_num - qm->qp_num) / ctrl->num_vfs; + if (val == ctrl->num_vfs) { + qm->debug.curr_qm_qp_num = + qm->ctrl_q_num - qm->qp_num - + (ctrl->num_vfs - 1) * vfq_num; + } else { + qm->debug.curr_qm_qp_num = vfq_num; + } } writel(val, qm->io_base + QM_DFX_MB_CNT_VF); diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c index ca0c403a73ce1e43a580c5a6cfa1c1696f3651fc..cb939cc3b40e94aa2378ee41552827014064bf77 100644 --- a/drivers/crypto/hisilicon/zip/zip_main.c +++ b/drivers/crypto/hisilicon/zip/zip_main.c @@ -484,15 +484,18 @@ static int current_qm_write(struct ctrl_debug_file *file, u32 val) if (val > ctrl->num_vfs) return -EINVAL; - /* According PF or VF Dev ID to calculation the curr_qm_qp_num */ - vfq_num = (qm->ctrl_q_num - qm->qp_num) / ctrl->num_vfs; + /* According PF or VF Dev ID to calculation curr_qm_qp_num and store */ if (val == 0) { qm->debug.curr_qm_qp_num = qm->qp_num; - } else if (val == ctrl->num_vfs) { - qm->debug.curr_qm_qp_num = qm->ctrl_q_num - qm->qp_num - - (ctrl->num_vfs - 1) * vfq_num; } else { - qm->debug.curr_qm_qp_num = vfq_num; + vfq_num = (qm->ctrl_q_num - qm->qp_num) / ctrl->num_vfs; + if (val == ctrl->num_vfs) { + qm->debug.curr_qm_qp_num = + qm->ctrl_q_num - qm->qp_num - + (ctrl->num_vfs - 1) * vfq_num; + } else { + qm->debug.curr_qm_qp_num = vfq_num; + } } writel(val, qm->io_base + QM_DFX_MB_CNT_VF);