
From: Chenghai Huang <huangchenghai2@huawei.com> 1.Use the local variable to set sched_params to avoid warning: warning: storing the address of local variable 'params' in '*priv.setup.sched_param' [-Wdangling-pointer=] 2.Add static before internal functions. 3.Remove unused variables and tags. Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com> --- src/uadk_prov_cipher.c | 7 +++++-- src/uadk_prov_digest.c | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/uadk_prov_cipher.c b/src/uadk_prov_cipher.c index 6d3e2c1..ab9b239 100644 --- a/src/uadk_prov_cipher.c +++ b/src/uadk_prov_cipher.c @@ -579,6 +579,7 @@ init_err: static int uadk_prov_cipher_ctx_init(struct cipher_priv_ctx *priv) { + struct wd_cipher_sess_setup setup = {0}; struct sched_params params = {0}; int ret; @@ -601,10 +602,12 @@ static int uadk_prov_cipher_ctx_init(struct cipher_priv_ctx *priv) params.type = 0; /* Use the default numa parameters */ params.numa_id = -1; - priv->setup.sched_param = ¶ms; + setup.sched_param = ¶ms; + setup.alg = priv->setup.alg; + setup.mode = priv->setup.mode; if (!priv->sess) { - priv->sess = wd_cipher_alloc_sess(&priv->setup); + priv->sess = wd_cipher_alloc_sess(&setup); if (!priv->sess) { fprintf(stderr, "uadk failed to alloc session!\n"); return UADK_P_FAIL; diff --git a/src/uadk_prov_digest.c b/src/uadk_prov_digest.c index 98e25e1..808a758 100644 --- a/src/uadk_prov_digest.c +++ b/src/uadk_prov_digest.c @@ -814,7 +814,6 @@ static void uadk_prov_freectx(void *dctx) static void *uadk_prov_dupctx(void *dctx) { struct digest_priv_ctx *dst_ctx, *src_ctx; - int ret; src_ctx = (struct digest_priv_ctx *)dctx; if (!dctx) @@ -957,7 +956,7 @@ static int uadk_prov_digest(void *dctx, const unsigned char *in, size_t inl, return ret; } - if (unlikely(outl != NULL)) + if (outl) *outl = priv->md_size; return UADK_DIGEST_SUCCESS; -- 2.33.0