From 8ce0ba841358d85eb89bf726d229dfaf4cd13156 Mon Sep 17 00:00:00 2001 From: Weili Qian Date: Thu, 3 Mar 2022 02:59:13 +0000 Subject: [PATCH 28/31] ecc: fix checking conditions When initializing, the process is guaranteed not to be initialized repeatedly. And when uninitializing, the resource is released according to whether the pid is equal or not. Signed-off-by: Weili Qian Signed-off-by: Zhiqi Song --- src/uadk_pkey.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/uadk_pkey.c b/src/uadk_pkey.c index 14e0b8f..ceb7a8f 100644 --- a/src/uadk_pkey.c +++ b/src/uadk_pkey.c @@ -184,9 +184,6 @@ static int uadk_e_wd_ecc_general_init(struct uacce_dev *dev, struct wd_ctx_config *ctx_cfg; int ret, i; - if (ecc_res.ctx_res) - return 0; - ctx_cfg = calloc(1, sizeof(struct wd_ctx_config)); if (!ctx_cfg) return -ENOMEM; @@ -256,7 +253,7 @@ static void uadk_wd_ecc_uninit(void) struct wd_ctx_config *ctx_cfg = ecc_res.ctx_res; int i, ret; - if (!ctx_cfg) + if (ecc_res.pid != getpid()) return; ret = uadk_e_is_env_enabled("ecc"); -- 2.24.4