
From: Longfang Liu <liulongfang@huawei.com> In the user-space driver of UADK, when performing the operation to exit and deregister the driver, the added parameter check is placed before the variable declarations in the function, causing inconsistency in code style with other parts. Signed-off-by: Longfang Liu <liulongfang@huawei.com> Signed-off-by: Qi Tao <taoqi10@huawei.com> --- drv/hash_mb/hash_mb.c | 7 ++++--- drv/hisi_comp.c | 9 +++++---- drv/hisi_dae.c | 9 +++++---- drv/hisi_hpre.c | 9 +++++---- drv/hisi_sec.c | 9 +++++---- drv/isa_ce_sm3.c | 7 ++++--- drv/isa_ce_sm4.c | 7 ++++--- 7 files changed, 32 insertions(+), 25 deletions(-) diff --git a/drv/hash_mb/hash_mb.c b/drv/hash_mb/hash_mb.c index f0f27b59..bd412b23 100644 --- a/drv/hash_mb/hash_mb.c +++ b/drv/hash_mb/hash_mb.c @@ -217,11 +217,12 @@ static int hash_mb_init(struct wd_alg_driver *drv, void *conf) static void hash_mb_exit(struct wd_alg_driver *drv) { - if(!drv || !drv->priv) - return; + struct hash_mb_ctx *priv; - struct hash_mb_ctx *priv = (struct hash_mb_ctx *)drv->priv; + if (!drv || !drv->priv) + return; + priv = (struct hash_mb_ctx *)drv->priv; hash_mb_queue_uninit(&priv->config, priv->config.ctx_num); free(priv); drv->priv = NULL; diff --git a/drv/hisi_comp.c b/drv/hisi_comp.c index 7a106652..0e9cd65d 100644 --- a/drv/hisi_comp.c +++ b/drv/hisi_comp.c @@ -1054,14 +1054,15 @@ out: static void hisi_zip_exit(struct wd_alg_driver *drv) { - if(!drv || !drv->priv) - return; - - struct hisi_zip_ctx *priv = (struct hisi_zip_ctx *)drv->priv; struct wd_ctx_config_internal *config; + struct hisi_zip_ctx *priv; handle_t h_qp; __u32 i; + if (!drv || !drv->priv) + return; + + priv = (struct hisi_zip_ctx *)drv->priv; config = &priv->config; for (i = 0; i < config->ctx_num; i++) { h_qp = (handle_t)wd_ctx_get_priv(config->ctxs[i].ctx); diff --git a/drv/hisi_dae.c b/drv/hisi_dae.c index b9f6ee07..9c2ca8b1 100644 --- a/drv/hisi_dae.c +++ b/drv/hisi_dae.c @@ -1612,14 +1612,15 @@ out: static void dae_exit(struct wd_alg_driver *drv) { - if(!drv || !drv->priv) - return; - - struct hisi_dae_ctx *priv = (struct hisi_dae_ctx *)drv->priv; struct wd_ctx_config_internal *config; + struct hisi_dae_ctx *priv; handle_t h_qp; __u32 i; + if (!drv || !drv->priv) + return; + + priv = (struct hisi_dae_ctx *)drv->priv; config = &priv->config; for (i = 0; i < config->ctx_num; i++) { h_qp = (handle_t)wd_ctx_get_priv(config->ctxs[i].ctx); diff --git a/drv/hisi_hpre.c b/drv/hisi_hpre.c index 30411609..e0cd7424 100644 --- a/drv/hisi_hpre.c +++ b/drv/hisi_hpre.c @@ -592,14 +592,15 @@ static int hpre_ecc_init(struct wd_alg_driver *drv, void *conf) static void hpre_exit(struct wd_alg_driver *drv) { - if(!drv || !drv->priv) - return; - - struct hisi_hpre_ctx *priv = (struct hisi_hpre_ctx *)drv->priv; struct wd_ctx_config_internal *config; + struct hisi_hpre_ctx *priv; handle_t h_qp; __u32 i; + if (!drv || !drv->priv) + return; + + priv = (struct hisi_hpre_ctx *)drv->priv; config = &priv->config; for (i = 0; i < config->ctx_num; i++) { h_qp = (handle_t)wd_ctx_get_priv(config->ctxs[i].ctx); diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c index 5990565a..747d3a8e 100644 --- a/drv/hisi_sec.c +++ b/drv/hisi_sec.c @@ -3104,14 +3104,15 @@ out: static void hisi_sec_exit(struct wd_alg_driver *drv) { - if(!drv || !drv->priv) - return; - - struct hisi_sec_ctx *priv = (struct hisi_sec_ctx *)drv->priv; struct wd_ctx_config_internal *config; + struct hisi_sec_ctx *priv; handle_t h_qp; __u32 i; + if (!drv || !drv->priv) + return; + + priv = (struct hisi_sec_ctx *)drv->priv; config = &priv->config; for (i = 0; i < config->ctx_num; i++) { h_qp = (handle_t)wd_ctx_get_priv(config->ctxs[i].ctx); diff --git a/drv/isa_ce_sm3.c b/drv/isa_ce_sm3.c index 4ad21705..68be912a 100644 --- a/drv/isa_ce_sm3.c +++ b/drv/isa_ce_sm3.c @@ -387,11 +387,12 @@ static int sm3_ce_drv_init(struct wd_alg_driver *drv, void *conf) static void sm3_ce_drv_exit(struct wd_alg_driver *drv) { - if(!drv || !drv->priv) - return; + struct sm3_ce_drv_ctx *sctx; - struct sm3_ce_drv_ctx *sctx = (struct sm3_ce_drv_ctx *)drv->priv; + if (!drv || !drv->priv) + return; + sctx = (struct sm3_ce_drv_ctx *)drv->priv; free(sctx); drv->priv = NULL; } diff --git a/drv/isa_ce_sm4.c b/drv/isa_ce_sm4.c index 5e448fa0..52dca1f5 100644 --- a/drv/isa_ce_sm4.c +++ b/drv/isa_ce_sm4.c @@ -53,11 +53,12 @@ static int isa_ce_init(struct wd_alg_driver *drv, void *conf) static void isa_ce_exit(struct wd_alg_driver *drv) { - if(!drv || !drv->priv) - return; + struct sm4_ce_drv_ctx *sctx; - struct sm4_ce_drv_ctx *sctx = (struct sm4_ce_drv_ctx *)drv->priv; + if (!drv || !drv->priv) + return; + sctx = (struct sm4_ce_drv_ctx *)drv->priv; free(sctx); drv->priv = NULL; } -- 2.33.0