From 0feee4ccc2b3d0f60d84d39310fc1f85a3d28d63 Mon Sep 17 00:00:00 2001
From: Wenkai Lin <linwenkai6@hisilicon.com>
Date: Thu, 30 Dec 2021 12:07:30 +0800
Subject: [PATCH 18/28] uadk: fix static check warning

1.set null pointer after free.
2.define const pointer.

Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
---
 wd_sched.c | 4 +++-
 wd_util.c  | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/wd_sched.c b/wd_sched.c
index b310077..3330a4d 100644
--- a/wd_sched.c
+++ b/wd_sched.c
@@ -406,8 +406,10 @@ void wd_sched_rr_release(struct wd_sched *sched)
 	sched_info = sched_ctx->sched_info;
 	for (i = 0; i < sched_ctx->numa_num; i++) {
 		for (j = 0; j < SCHED_MODE_BUTT; j++) {
-			if (sched_info[i].ctx_region[j])
+			if (sched_info[i].ctx_region[j]) {
 				free(sched_info[i].ctx_region[j]);
+				sched_info[i].ctx_region[j] = NULL;
+			}
 		}
 	}
 
diff --git a/wd_util.c b/wd_util.c
index faaf821..62f9359 100644
--- a/wd_util.c
+++ b/wd_util.c
@@ -403,7 +403,7 @@ static void wd_set_numa_dev(struct uacce_dev_list *head,
 }
 
 static int wd_set_config_numa(struct wd_env_config *config,
-			      int *numa_dev_num, int max_node)
+			      const int *numa_dev_num, int max_node)
 {
 	struct wd_env_config_per_numa *config_numa;
 	int i;
-- 
2.31.1

