Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

driver: crypto: hisilicon: fix error handling #6648

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions core/drivers/crypto/hisilicon/hisi_qm.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,6 @@ static enum hisi_drv_status qm_set_xqc_vft(struct hisi_qm *qm,
enum hisi_drv_status ret = HISI_QM_DRVCRYPT_NO_ERR;
int i = 0;

if (!num) {
EMSG("Invalid sq num");
return HISI_QM_DRVCRYPT_EINVAL;
}

for (i = QM_SQC_VFT; i <= QM_CQC_VFT; i++) {
ret = qm_set_vft_common(qm, i, function, base, num);
if (ret) {
Expand Down Expand Up @@ -736,18 +731,20 @@ struct hisi_qp *hisi_qm_create_qp(struct hisi_qm *qm, uint8_t sq_type)

if (qm_sqc_cfg(qp)) {
EMSG("Fail to set qp[%"PRIu32"] sqc", qp->qp_id);
goto err_proc;
goto err_qp_release;
}

if (qm_cqc_cfg(qp)) {
EMSG("Fail to set qp[%"PRIu32"] cqc", qp->qp_id);
goto err_proc;
goto err_qp_release;
}

qm->qp_in_used++;
mutex_unlock(&qm->qp_lock);
return qp;

err_qp_release:
qp->used = false;
err_proc:
qp->sq_type = 0;
qp->cqc_phase = false;
Expand Down Expand Up @@ -875,8 +872,8 @@ enum hisi_drv_status hisi_qp_recv_sync(struct hisi_qp *qp, void *msg)
enum hisi_drv_status ret = HISI_QM_DRVCRYPT_NO_ERR;
uint32_t timeout = 0;

if (!qp) {
EMSG("QP is NULL");
if (!qp || !qp->qm || !msg) {
EMSG("Invalid qp recv sync parameters");
return HISI_QM_DRVCRYPT_EINVAL;
}

Expand Down
Loading