From: Junchong Pan <panjunchong(a)h-partners.com>
Initialize ret to 0 in wd_ctx_param_init() to fix -Wmaybe-uninitialized
warning. Change ret type from int to size_t in get_str_attr() to fix
-Wsign-compare warning. Move sched_uninit and set_param to the end of
struct wd_sched to maintain ABI compatibility.
Signed-off-by: Junchong Pan <panjunchong(a)h-partners.com>
---
include/wd_alg_common.h | 4 ++--
wd.c | 2 +-
wd_util.c | 5 +++--
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/wd_alg_common.h b/include/wd_alg_common.h
index 05cc5c0..f0e13bb 100644
--- a/include/wd_alg_common.h
+++ b/include/wd_alg_common.h
@@ -165,13 +165,13 @@ struct wd_sched {
const char *name;
int sched_policy;
handle_t (*sched_init)(handle_t h_sched_ctx, void *sched_param);
- void (*sched_uninit)(handle_t h_sched_ctx, handle_t h_sched_key);
__u32 (*pick_next_ctx)(handle_t h_sched_ctx,
void *sched_key,
const int sched_mode);
int (*poll_policy)(handle_t h_sched_ctx, __u32 expect, __u32 *count);
- void (*set_param)(handle_t h_sched_ctx, void *sched_key, void *sched_param);
handle_t h_sched_ctx;
+ void (*sched_uninit)(handle_t h_sched_ctx, handle_t h_sched_key);
+ void (*set_param)(handle_t h_sched_ctx, void *sched_key, void *sched_param);
};
typedef int (*wd_alg_init)(struct wd_ctx_config *config, struct wd_sched *sched);
diff --git a/wd.c b/wd.c
index f973c70..1c28bb3 100644
--- a/wd.c
+++ b/wd.c
@@ -203,7 +203,7 @@ static int get_int_attr(struct uacce_dev *dev, const char *attr, int *val)
static int get_str_attr(struct uacce_dev *dev, const char *attr, char *buf,
size_t buf_sz)
{
- int ret;
+ size_t ret;
int size;
size = get_raw_attr(dev->dev_root, attr, buf, buf_sz);
diff --git a/wd_util.c b/wd_util.c
index 1b4c74e..bf6d380 100644
--- a/wd_util.c
+++ b/wd_util.c
@@ -1765,7 +1765,7 @@ static int wd_env_set_ctx_nums(const char *alg_name, const char *name, const cha
{
char *left, *section, *start;
int is_comp;
- int ret;
+ int ret = 0;
/* COMP environment variable's format is different, mark it */
is_comp = strncmp(name, "WD_COMP_CTX_NUM", sizeof("WD_COMP_CTX_NUM") - 1) ? 0 : 1;
@@ -1799,7 +1799,8 @@ int wd_ctx_param_init(struct wd_ctx_params *ctx_params,
{
const char *env_name = wd_env_name[type];
const char *var_s;
- int i, ret;
+ int ret = 0;
+ int i;
ctx_params->bmp = numa_allocate_nodemask();
if (!ctx_params->bmp) {
--
2.43.0