From f58af3995b2ce367210f0bf4cc8d1def791c88f9 Mon Sep 17 00:00:00 2001
From: veega2022 <zhuweijia@huawei.com>
Date: Fri, 14 Mar 2025 20:10:53 +0800
Subject: [PATCH] hikptool: Added compilation options.

The following compilation options are added:

-Wuninitialized -Wundef -Wunused -Wdate-time
-Wshadow -Wvla -Wdisabled-optimization -Wempty-body -Wignored-qualifiers
-Wimplicit-fallthrough=3 -Wtype-limits -Wshift-negative-value -Wswitch-default
-Wframe-larger-than=8192 -Wshift-overflow=2 -Wwrite-strings -Wmissing-format-attribute
-Wformat-nonliteral -Wduplicated-cond -Wtrampolines -Wlogical-op -Wsuggest-attribute=format
-Wduplicated-branches -Wmissing-include-dirs -Wmissing-declarations
-Wreturn-local-addr -Wredundant-decls -Wfloat-conversion -Wmissing-prototypes
-Wno-discarded-qualifiers -Wstrict-prototypes

And alos rectify compilation alarms and errors.

Signed-off-by: veega2022 <zhuweijia@huawei.com>
---
 CMakeLists.txt                                | 10 +++++-
 cxl/usr_cmd/cmd_analysis/cxl_cmd_cpa.c        | 16 ++++++++++
 cxl/usr_cmd/cmd_analysis/cxl_cmd_dl.c         | 16 ++++++++++
 cxl/usr_cmd/cmd_analysis/cxl_cmd_membar.c     | 10 ++++++
 cxl/usr_cmd/cmd_analysis/cxl_cmd_rcrb.c       | 13 ++++++++
 libhikptdev/src/rciep/hikpt_rciep.c           | 28 ++++++++++------
 net/hikp_net_lib.c                            |  4 +--
 net/nic/nic_dfx/hikp_nic_dfx.c                |  2 ++
 net/nic/nic_fd/hikp_nic_fd.c                  | 23 +++++++------
 net/nic/nic_fec/hikp_nic_fec.c                |  2 ++
 net/nic/nic_ft/hikp_nic_port_fault.c          |  2 ++
 net/nic/nic_gro/hikp_nic_gro.c                |  2 ++
 net/nic/nic_info/hikp_nic_info.c              |  2 ++
 net/nic/nic_log/hikp_nic_log.c                |  2 ++
 net/nic/nic_mac/hikp_nic_mac_dump.c           |  4 +++
 net/nic/nic_mac/hikp_nic_port.c               |  2 ++
 net/nic/nic_mac/hikp_nic_xsfp.c               | 17 ++++++----
 net/nic/nic_ncsi/hikp_nic_ncsi.c              |  2 ++
 net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c  |  2 ++
 net/nic/nic_ppp/hikp_nic_ppp.c                |  4 +++
 net/nic/nic_qos/hikp_nic_qos.c                |  2 ++
 net/nic/nic_queue/hikp_nic_queue.c            |  2 ++
 net/nic/nic_rss/hikp_nic_rss.c                |  2 ++
 net/nic/nic_torus/hikp_nic_torus.c            |  2 ++
 net/roce/roce_bond/hikp_roce_bond.c           |  4 +++
 net/roce/roce_caep/hikp_roce_caep.c           |  7 ++++
 .../roce_global_cfg/hikp_roce_global_cfg.c    |  6 +++-
 net/roce/roce_gmv/hikp_roce_gmv.c             |  4 +++
 net/roce/roce_mdb/hikp_roce_mdb.c             |  8 +++++
 net/roce/roce_pkt/hikp_roce_pkt.c             |  5 +++
 net/roce/roce_qmm/hikp_roce_qmm.c             | 10 ++++--
 net/roce/roce_rst/hikp_roce_rst.c             |  4 +++
 net/roce/roce_scc/hikp_roce_scc.c             |  5 +++
 net/roce/roce_timer/hikp_roce_timer.c         | 11 ++++++-
 net/roce/roce_trp/hikp_roce_trp.c             |  2 ++
 net/roce/roce_tsp/hikp_roce_tsp.c             |  5 +++
 net/roh/hikp_roh_mac.c                        |  6 ++--
 net/roh/hikp_roh_show_bp.c                    |  5 +++
 net/roh/hikp_roh_show_mib.c                   |  5 +++
 net/ub/ub_bp/hikp_ub_bp.c                     |  2 ++
 net/ub/ub_crd/hikp_ub_crd.c                   |  2 ++
 net/ub/ub_dfx/hikp_ub_dfx.c                   |  2 ++
 net/ub/ub_info/hikp_ub_info.c                 |  2 ++
 net/ub/ub_link/hikp_ub_link.c                 |  2 ++
 net/ub/ub_ppp/hikp_unic_ppp.c                 |  7 ++--
 pcie/func_lib/pcie_func/pcie_reg_dump.c       |  2 +-
 pcie/usr_cmd/cmd_analysis/pcie_cmd_dumpreg.c  |  9 ++++++
 pcie/usr_cmd/cmd_analysis/pcie_cmd_info.c     | 13 ++++++++
 pcie/usr_cmd/cmd_analysis/pcie_cmd_reg_read.c | 11 +++++++
 pcie/usr_cmd/cmd_analysis/pcie_cmd_trace.c    | 18 +++++++++++
 sas/sas_func/sas_analy_queue.c                |  2 +-
 sas/sas_func/sas_dump_reg.c                   |  6 ++--
 sas/sas_func/sas_read_dev.c                   |  6 ++--
 sas/sas_func/sas_read_dqe.c                   |  6 ++--
 sas/sas_func/sas_read_errcode.c               |  2 +-
 sas/user_cmd/cmd_code/sas_cmd_anacq.c         |  8 +++++
 sas/user_cmd/cmd_code/sas_cmd_anadq.c         |  8 +++++
 sas/user_cmd/cmd_code/sas_cmd_common.c        |  2 +-
 sas/user_cmd/cmd_code/sas_cmd_dev.c           |  5 +++
 sas/user_cmd/cmd_code/sas_cmd_dqe.c           |  4 ++-
 sas/user_cmd/cmd_code/sas_cmd_dump.c          |  8 +++++
 sas/user_cmd/cmd_code/sas_cmd_errcode.c       |  2 ++
 sata/sata_func/sata_dump_reg.c                |  4 +--
 sata/user_cmd/cmd_code/sata_cmd_dump.c        | 11 +++++++
 serdes/hikp_serdes.c                          |  7 ++++
 socip/hikp_socip_dumpreg.c                    |  2 ++
 tool_lib/op_logs.c                            | 32 +++++++++----------
 tool_lib/tool_lib.c                           |  2 +-
 tool_lib/tool_lib.h                           |  4 +++
 69 files changed, 377 insertions(+), 72 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f28a870..56cc932 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,15 @@
 
 project(hikptool C)
 
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -fPIC -fPIE -Wall -Werror -fno-common -std=gnu11")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
+ -O2 -fPIC -fPIE -Wall -Werror -Wextra -Wuninitialized -Wundef -Wunused -Wdate-time \
+ -Wshadow -Wvla -Wdisabled-optimization -Wempty-body -Wignored-qualifiers \
+ -Wimplicit-fallthrough=3 -Wtype-limits -Wshift-negative-value -Wswitch-default \
+ -Wframe-larger-than=8192 -Wshift-overflow=2 -Wwrite-strings -Wmissing-format-attribute \
+ -Wformat-nonliteral -Wduplicated-cond -Wtrampolines -Wlogical-op -Wsuggest-attribute=format \
+ -Wduplicated-branches -Wmissing-include-dirs -Wmissing-declarations \
+ -Wreturn-local-addr -Wredundant-decls -Wfloat-conversion -Wmissing-prototypes \
+ -Wno-discarded-qualifiers -Wstrict-prototypes -fno-common -std=gnu11")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-equal -fstack-protector-strong -D_FORTIFY_SOURCE=2")
 set(CMAKE_SKIP_RPATH TRUE)
 
diff --git a/cxl/usr_cmd/cmd_analysis/cxl_cmd_cpa.c b/cxl/usr_cmd/cmd_analysis/cxl_cmd_cpa.c
index 2df9dc5..208a7d4 100644
--- a/cxl/usr_cmd/cmd_analysis/cxl_cmd_cpa.c
+++ b/cxl/usr_cmd/cmd_analysis/cxl_cmd_cpa.c
@@ -25,6 +25,8 @@ struct tool_cxl_cmd g_cxl_cpa_cmd = {
 
 static int cxl_cpa_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("  Usage: %s\n", self->cmd_ptr->name);
 	printf("         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-i", "--interface", "please input port[x]  first");
@@ -44,6 +46,8 @@ static int cxl_port_id_set(struct major_cmd_ctrl *self, const char *argv)
 	uint32_t val;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	ret = string_toui(argv, &val);
 	if (ret) {
 		printf("cxl cpa set port id err %d\n", ret);
@@ -56,6 +60,9 @@ static int cxl_port_id_set(struct major_cmd_ctrl *self, const char *argv)
 
 static int cxl_cpa_err_status_show(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_cpa_cmd.cmd_type = CPA_ERR;
 
 	return 0;
@@ -63,6 +70,9 @@ static int cxl_cpa_err_status_show(struct major_cmd_ctrl *self, const char *argv
 
 static int cxl_cpa_mmrg_show(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_cpa_cmd.cmd_type = CPA_MMRG;
 
 	return 0;
@@ -70,6 +80,9 @@ static int cxl_cpa_mmrg_show(struct major_cmd_ctrl *self, const char *argv)
 
 static int cxl_cpa_dump(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_cpa_cmd.cmd_type = CPA_DUMP;
 
 	return 0;
@@ -77,6 +90,9 @@ static int cxl_cpa_dump(struct major_cmd_ctrl *self, const char *argv)
 
 static int cxl_cpa_config(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_cpa_cmd.cmd_type = CPA_CONFIG;
 
 	return 0;
diff --git a/cxl/usr_cmd/cmd_analysis/cxl_cmd_dl.c b/cxl/usr_cmd/cmd_analysis/cxl_cmd_dl.c
index 226db1e..7ac0784 100644
--- a/cxl/usr_cmd/cmd_analysis/cxl_cmd_dl.c
+++ b/cxl/usr_cmd/cmd_analysis/cxl_cmd_dl.c
@@ -25,6 +25,8 @@ struct tool_cxl_cmd g_cxl_dl_cmd = {
 
 static int cxl_dl_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("  Usage: %s\n", self->cmd_ptr->name);
 	printf("         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-i", "--interface", "please input port[x]  first");
@@ -44,6 +46,8 @@ static int cxl_dl_port_id_set(struct major_cmd_ctrl *self, const char *argv)
 	uint32_t val;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	ret = string_toui(argv, &val);
 	if (ret) {
 		printf("cxl dl set port id err %d\n", ret);
@@ -56,6 +60,9 @@ static int cxl_dl_port_id_set(struct major_cmd_ctrl *self, const char *argv)
 
 static int cxl_dl_err_status(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_dl_cmd.cmd_type = CXL_DL_ERR;
 
 	return 0;
@@ -63,6 +70,9 @@ static int cxl_dl_err_status(struct major_cmd_ctrl *self, const char *argv)
 
 static int cxl_dl_dump(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_dl_cmd.cmd_type = CXL_DL_DUMP;
 
 	return 0;
@@ -70,6 +80,9 @@ static int cxl_dl_dump(struct major_cmd_ctrl *self, const char *argv)
 
 static int cxl_dl_dfx(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_dl_cmd.cmd_type = CXL_DL_DFX;
 
 	return 0;
@@ -77,6 +90,9 @@ static int cxl_dl_dfx(struct major_cmd_ctrl *self, const char *argv)
 
 static int cxl_dl_fsm_state(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_dl_cmd.cmd_type = CXL_DL_FSM_STATE;
 
 	return 0;
diff --git a/cxl/usr_cmd/cmd_analysis/cxl_cmd_membar.c b/cxl/usr_cmd/cmd_analysis/cxl_cmd_membar.c
index f444b56..0ebca4f 100644
--- a/cxl/usr_cmd/cmd_analysis/cxl_cmd_membar.c
+++ b/cxl/usr_cmd/cmd_analysis/cxl_cmd_membar.c
@@ -25,6 +25,8 @@ struct tool_cxl_cmd g_cxl_membar_cmd = {
 
 static int cxl_membar_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("  Usage: %s\n", self->cmd_ptr->name);
 	printf("         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-i", "--interface", "please input port[x]  first");
@@ -42,6 +44,8 @@ static int cxl_membar_port_id_set(struct major_cmd_ctrl *self, const char *argv)
 	uint32_t val;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	ret = string_toui(argv, &val);
 	if (ret) {
 		printf("cxl membar set port id err %d\n", ret);
@@ -54,6 +58,9 @@ static int cxl_membar_port_id_set(struct major_cmd_ctrl *self, const char *argv)
 
 static int cxl_membar_err_info(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_membar_cmd.cmd_type = CXL_MEMBAR_ERR;
 
 	return 0;
@@ -61,6 +68,9 @@ static int cxl_membar_err_info(struct major_cmd_ctrl *self, const char *argv)
 
 static int cxl_membar_dump(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_membar_cmd.cmd_type = CXL_MEMBAR_DUMP;
 
 	return 0;
diff --git a/cxl/usr_cmd/cmd_analysis/cxl_cmd_rcrb.c b/cxl/usr_cmd/cmd_analysis/cxl_cmd_rcrb.c
index f83b64d..0179605 100644
--- a/cxl/usr_cmd/cmd_analysis/cxl_cmd_rcrb.c
+++ b/cxl/usr_cmd/cmd_analysis/cxl_cmd_rcrb.c
@@ -25,6 +25,8 @@ struct tool_cxl_cmd g_cxl_rcrb_cmd = {
 
 static int cxl_rcrb_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("  Usage: %s\n", self->cmd_ptr->name);
 	printf("         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-i", "--interface", "please input port[x]  first");
@@ -43,6 +45,8 @@ static int cxl_rcrb_port_id_set(struct major_cmd_ctrl *self, const char *argv)
 	uint32_t val;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	ret = string_toui(argv, &val);
 	if (ret) {
 		printf("cxl rcrb set port id err %d\n", ret);
@@ -55,6 +59,9 @@ static int cxl_rcrb_port_id_set(struct major_cmd_ctrl *self, const char *argv)
 
 static int cxl_rcrb_link_status(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_rcrb_cmd.cmd_type = CXL_RCRB_LINK;
 
 	return 0;
@@ -62,6 +69,9 @@ static int cxl_rcrb_link_status(struct major_cmd_ctrl *self, const char *argv)
 
 static int cxl_rcrb_header_info(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_rcrb_cmd.cmd_type = CXL_RCRB_HDR;
 
 	return 0;
@@ -69,6 +79,9 @@ static int cxl_rcrb_header_info(struct major_cmd_ctrl *self, const char *argv)
 
 static int cxl_rcrb_dump(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_cxl_rcrb_cmd.cmd_type = CXL_RCRB_DUMP;
 
 	return 0;
diff --git a/libhikptdev/src/rciep/hikpt_rciep.c b/libhikptdev/src/rciep/hikpt_rciep.c
index 5a38b3b..88ac16e 100644
--- a/libhikptdev/src/rciep/hikpt_rciep.c
+++ b/libhikptdev/src/rciep/hikpt_rciep.c
@@ -526,27 +526,35 @@ static void hikp_munmap(void)
 	g_hikp_rsp = NULL;
 }
 
+static int hikp_dev_set_iep_fd(char *iep)
+{
+	char path[PATH_MAX + 1] = { 0 };
+
+	if (strlen(iep) > PATH_MAX || realpath(iep, path) == NULL)
+		return -ENOENT;
+
+	g_iep_fd = open(path, O_RDWR | O_SYNC);
+	if (g_iep_fd < 0) {
+		printf("failed to open %s.\n", iep);
+		return -errno;
+	}
+
+	return 0;
+}
+
 int hikp_dev_init(void)
 {
 	size_t i, len;
 	int ret = 0;
 	char *iep;
-	char path[PATH_MAX + 1] = { 0 };
 
 	iep = hikp_get_iep_dir(HIKP_RESOURCE_DIR);
 	if (iep == NULL)
 		return -ENOENT;
 
-	if (strlen(iep) > PATH_MAX || realpath(iep, path) == NULL) {
-		ret = -ENOENT;
-		goto out_free_iep;
-	}
-	g_iep_fd = open(path, O_RDWR | O_SYNC);
-	if (g_iep_fd < 0) {
-		printf("failed to open %s.\n", iep);
-		ret = -errno;
+	ret = hikp_dev_set_iep_fd(iep);
+	if (ret)
 		goto out_free_iep;
-	}
 
 	g_hikp_req = (union hikp_space_req *)mmap(0, sizeof(union hikp_space_req),
 		     PROT_READ | PROT_WRITE, MAP_SHARED, g_iep_fd, 0);
diff --git a/net/hikp_net_lib.c b/net/hikp_net_lib.c
index f4d4c2a..7646aad 100644
--- a/net/hikp_net_lib.c
+++ b/net/hikp_net_lib.c
@@ -309,7 +309,7 @@ int get_vf_dev_info_by_pf_dev_name(const char *pf_dev_name,
 
 	ret = snprintf(dev_name_dir, sizeof(dev_name_dir), "%s%s%s%u%s", HIKP_NET_DEV_PATH,
 		       pf_dev_name, HIKP_VIRTFN_PATH, vf_id, HIKP_NET_PATH);
-	if (ret < 0 || ret >= sizeof(dev_name_dir)) {
+	if (ret < 0 || ret >= MAX_BUS_PCI_DIR_LEN) {
 		HIKP_ERROR_PRINT("get vf dev_name dir fail.\n");
 		return -EIO;
 	}
@@ -333,7 +333,7 @@ int get_pf_dev_info_by_vf_dev_name(const char *vf_dev_name, struct tool_target *
 
 	ret = snprintf(dev_name_dir, sizeof(dev_name_dir), "%s%s%s", HIKP_NET_DEV_PATH,
 		       vf_dev_name, HIKP_PHYSFN_PATH);
-	if (ret < 0 || ret >= sizeof(dev_name_dir)) {
+	if (ret < 0 || ret >= MAX_BUS_PCI_DIR_LEN) {
 		HIKP_ERROR_PRINT("get vf dev_name dir fail.\n");
 		return -EIO;
 	}
diff --git a/net/nic/nic_dfx/hikp_nic_dfx.c b/net/nic/nic_dfx/hikp_nic_dfx.c
index 3bc4e05..d6114de 100644
--- a/net/nic/nic_dfx/hikp_nic_dfx.c
+++ b/net/nic/nic_dfx/hikp_nic_dfx.c
@@ -424,6 +424,8 @@ static void dfx_help_info(const struct major_cmd_ctrl *self)
 
 static int hikp_cmd_dfx_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	dfx_help_info(self);
 	return 0;
 }
diff --git a/net/nic/nic_fd/hikp_nic_fd.c b/net/nic/nic_fd/hikp_nic_fd.c
index d19d7c8..fb5f029 100644
--- a/net/nic/nic_fd/hikp_nic_fd.c
+++ b/net/nic/nic_fd/hikp_nic_fd.c
@@ -118,6 +118,8 @@ void hikp_nic_set_fd_idx(int feature_idx, int stage_no)
 
 static int hikp_nic_fd_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
@@ -640,6 +642,8 @@ static int hikp_nic_query_fd_rules(struct hikp_cmd_header *req_header, const str
 	uint32_t idx;
 	int ret = 0;
 
+	HIKP_SET_USED(len);
+
 	if (stage >= NIC_FD_STAGE_NUM) {
 		HIKP_ERROR_PRINT("The fd stage number(%d) is error!\n", stage + 1);
 		return -EIO;
@@ -700,6 +704,8 @@ static int hikp_nic_query_fd_counter(struct hikp_cmd_header *req_header, const s
 	uint16_t idx;
 	int ret = 0;
 
+	HIKP_SET_USED(len);
+
 	if (stage >= NIC_FD_STAGE_NUM) {
 		HIKP_ERROR_PRINT("The fd stage number(%d) is error!\n", stage + 1);
 		return -EIO;
@@ -757,7 +763,7 @@ static int hikp_nic_get_fd_hw_info(const struct bdf_t *bdf, struct nic_fd_hw_inf
 					 sizeof(*hw_info));
 }
 
-static int hikp_nic_fd_alloc_rules_buf(struct nic_fd_rules *rules, uint8_t stage_num,
+static int hikp_nic_fd_alloc_rules_buf(struct nic_fd_rules *rules,
 				       struct nic_fd_hw_info *hw_info, uint16_t stage_no)
 {
 	uint16_t max_key_bytes;
@@ -775,7 +781,7 @@ static int hikp_nic_fd_alloc_rules_buf(struct nic_fd_rules *rules, uint8_t stage
 	return 0;
 }
 
-static int hikp_nic_fd_alloc_counter_buf(struct nic_fd_counter *counter, uint8_t stage_num,
+static int hikp_nic_fd_alloc_counter_buf(struct nic_fd_counter *counter,
 					 struct nic_fd_hw_info *hw_info, uint16_t stage_no)
 {
 	counter[stage_no].entry =
@@ -789,8 +795,7 @@ static int hikp_nic_fd_alloc_counter_buf(struct nic_fd_counter *counter, uint8_t
 	return 0;
 }
 
-static union nic_fd_feature_info *hikp_nic_fd_data_alloc(const struct fd_feature_cmd *fd_cmd,
-							 const struct nic_fd_hw_info *hw_cfg)
+static union nic_fd_feature_info *hikp_nic_fd_data_alloc(const struct fd_feature_cmd *fd_cmd)
 {
 	uint16_t stage_no = g_fd_param.stage_no - 1;
 	union nic_fd_feature_info *fd_data;
@@ -803,11 +808,9 @@ static union nic_fd_feature_info *hikp_nic_fd_data_alloc(const struct fd_feature
 	}
 
 	if (strcmp(fd_cmd->feature_name, NIC_FD_RULES_NAME) == 0)
-		ret = hikp_nic_fd_alloc_rules_buf(fd_data->rules, NIC_FD_STAGE_NUM,
-						  &g_fd_hw_info, stage_no);
+		ret = hikp_nic_fd_alloc_rules_buf(fd_data->rules, &g_fd_hw_info, stage_no);
 	else if (strcmp(fd_cmd->feature_name, NIC_FD_COUNTER_NAME) == 0)
-		ret = hikp_nic_fd_alloc_counter_buf(fd_data->counter, NIC_FD_STAGE_NUM,
-						    &g_fd_hw_info, stage_no);
+		ret = hikp_nic_fd_alloc_counter_buf(fd_data->counter, &g_fd_hw_info, stage_no);
 	if (ret != 0)
 		goto out;
 
@@ -884,7 +887,7 @@ static int hikp_nic_fd_check_entry_index_valid(struct major_cmd_ctrl *self,
 		hw_entry_size = fd_cmd->sub_cmd_code == NIC_FD_RULES_INFO_DUMP ?
 				hw_info->alloc.stage_entry_num[stage_no] :
 				hw_info->alloc.stage_counter_num[stage_no];
-		if (fd_param->id >= hw_entry_size) {
+		if ((uint32_t)fd_param->id >= hw_entry_size) {
 			snprintf(self->err_str, sizeof(self->err_str),
 				 "entry id(%d) must be less than hardware specifications(%u).",
 				 fd_param->id, hw_entry_size);
@@ -963,7 +966,7 @@ void hikp_nic_fd_cmd_execute(struct major_cmd_ctrl *self)
 	if (ret != 0)
 		return;
 
-	fd_data = hikp_nic_fd_data_alloc(fd_cmd, &g_fd_hw_info);
+	fd_data = hikp_nic_fd_data_alloc(fd_cmd);
 	if (fd_data == NULL) {
 		HIKP_ERROR_PRINT("Fail to alloc fd data memory.\n");
 		self->err_no = -ENOMEM;
diff --git a/net/nic/nic_fec/hikp_nic_fec.c b/net/nic/nic_fec/hikp_nic_fec.c
index 13c6e13..8de0b59 100644
--- a/net/nic/nic_fec/hikp_nic_fec.c
+++ b/net/nic/nic_fec/hikp_nic_fec.c
@@ -126,6 +126,8 @@ void hikp_nic_fec_cmd_execute(struct major_cmd_ctrl *self)
 
 static int hikp_nic_fec_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
diff --git a/net/nic/nic_ft/hikp_nic_port_fault.c b/net/nic/nic_ft/hikp_nic_port_fault.c
index 331b1ec..7d15a07 100644
--- a/net/nic/nic_ft/hikp_nic_port_fault.c
+++ b/net/nic/nic_ft/hikp_nic_port_fault.c
@@ -98,6 +98,8 @@ void hikp_nic_port_fault_cmd_execute(struct major_cmd_ctrl *self)
 
 static int hikp_nic_port_fault_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
diff --git a/net/nic/nic_gro/hikp_nic_gro.c b/net/nic/nic_gro/hikp_nic_gro.c
index d821a47..3e9b31a 100644
--- a/net/nic/nic_gro/hikp_nic_gro.c
+++ b/net/nic/nic_gro/hikp_nic_gro.c
@@ -71,6 +71,8 @@ void hikp_nic_gro_cmd_execute(struct major_cmd_ctrl *self)
 
 static int hikp_nic_gro_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
diff --git a/net/nic/nic_info/hikp_nic_info.c b/net/nic/nic_info/hikp_nic_info.c
index 6fb17a2..b05d6ef 100644
--- a/net/nic/nic_info/hikp_nic_info.c
+++ b/net/nic/nic_info/hikp_nic_info.c
@@ -25,6 +25,8 @@ static struct nic_info_param g_info_param = { 0 };
 
 static int hikp_nic_cmd_get_info_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
diff --git a/net/nic/nic_log/hikp_nic_log.c b/net/nic/nic_log/hikp_nic_log.c
index be23ca3..0e2d556 100644
--- a/net/nic/nic_log/hikp_nic_log.c
+++ b/net/nic/nic_log/hikp_nic_log.c
@@ -27,6 +27,8 @@ static char g_log_path[OP_LOG_FILE_PATH_MAXLEN] = {0};
 
 static int hikp_nic_cmd_log_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
diff --git a/net/nic/nic_mac/hikp_nic_mac_dump.c b/net/nic/nic_mac/hikp_nic_mac_dump.c
index 751953c..e0d0891 100644
--- a/net/nic/nic_mac/hikp_nic_mac_dump.c
+++ b/net/nic/nic_mac/hikp_nic_mac_dump.c
@@ -217,6 +217,8 @@ int mac_cmd_dump_reg_target(struct major_cmd_ctrl *self, const char *argv)
 
 static int mac_cmd_dump_reg_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface> -m <module>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -235,6 +237,8 @@ static int mac_cmd_dump_reg_help(struct major_cmd_ctrl *self, const char *argv)
 
 int mac_cmd_dump_module_cfg(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+
 	g_dump_reg_info.module_name = argv;
 
 	return 0;
diff --git a/net/nic/nic_mac/hikp_nic_port.c b/net/nic/nic_mac/hikp_nic_port.c
index 737de07..396c3ec 100644
--- a/net/nic/nic_mac/hikp_nic_port.c
+++ b/net/nic/nic_mac/hikp_nic_port.c
@@ -619,6 +619,8 @@ static int mac_cmd_get_port_target(struct major_cmd_ctrl *self, const char *argv
 
 static int mac_cmd_port_show_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
diff --git a/net/nic/nic_mac/hikp_nic_xsfp.c b/net/nic/nic_mac/hikp_nic_xsfp.c
index 91daa52..fc24d59 100644
--- a/net/nic/nic_mac/hikp_nic_xsfp.c
+++ b/net/nic/nic_mac/hikp_nic_xsfp.c
@@ -313,7 +313,7 @@ static void sfp_print_dom_info(const struct sfp_page_info *info)
 	       (int8_t)info->page_a2.temperature[0], info->page_a2.temperature[1]);
 }
 
-static void hikp_show_sfp_info(const uint8_t *data, uint32_t size)
+static void hikp_show_sfp_info(const uint8_t *data)
 {
 	struct sfp_page_info *sfp_data = (struct sfp_page_info *)data;
 
@@ -412,7 +412,7 @@ static void qsfp_print_dom_info(const struct qsfp_page0_info *info)
 	       (int8_t)info->page_lower.temperature_msb, info->page_lower.temperature_lsb);
 }
 
-static void hikp_show_qsfp_info(const uint8_t *data, uint32_t size)
+static void hikp_show_qsfp_info(const uint8_t *data)
 {
 	struct qsfp_page0_info *qsfp_data = (struct qsfp_page0_info *)(data);
 
@@ -554,7 +554,7 @@ static void cmis_print_dom_info(const struct cmis_page_info *info)
 		       info->page0_lower.module_temp[1]);
 }
 
-static void hikp_show_cmis_info(const uint8_t *data, uint32_t size)
+static void hikp_show_cmis_info(const uint8_t *data)
 {
 	struct cmis_page_info *cmis_data = (struct cmis_page_info *)data;
 
@@ -567,17 +567,17 @@ static void hikp_show_cmis_info(const uint8_t *data, uint32_t size)
 static void hikp_xsfp_parse_info(const uint8_t *data, uint32_t size)
 {
 	if (data[SFF_ID_OFFSET] == ID_SFP) {
-		hikp_show_sfp_info(data, size);
+		hikp_show_sfp_info(data);
 	} else if (data[SFF_ID_OFFSET] == ID_QSFP ||
 		   data[SFF_ID_OFFSET] == ID_QSFP_PLUS ||
 		   data[SFF_ID_OFFSET] == ID_QSFP28) {
-		hikp_show_qsfp_info(data, size);
+		hikp_show_qsfp_info(data);
 	} else if (data[SFF_ID_OFFSET] == ID_QSFP_DD ||
 		   data[SFF_ID_OFFSET] == ID_SFP_DD ||
 		   data[SFF_ID_OFFSET] == ID_QSFP_P_CMIS ||
 		   data[SFF_ID_OFFSET] == ID_SFP_DD_CMIS ||
 		   data[SFF_ID_OFFSET] == ID_SFP_P_CMIS) {
-		hikp_show_cmis_info(data, size);
+		hikp_show_cmis_info(data);
 	} else {
 		/* unknown type just dump hex data */
 		hikp_xsfp_dump_hex(data, size);
@@ -702,6 +702,8 @@ ERR_OUT:
 
 static int hikp_xsfp_show_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface> [-d]");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
@@ -729,6 +731,9 @@ static int hikp_xsfp_get_target(struct major_cmd_ctrl *self, const char *argv)
 
 static int hikp_xsfp_dump_raw_data(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_xsfp_dump.dump_param |= XSFP_RAW_DATA_BIT;
 
 	return 0;
diff --git a/net/nic/nic_ncsi/hikp_nic_ncsi.c b/net/nic/nic_ncsi/hikp_nic_ncsi.c
index 84f6337..955e456 100644
--- a/net/nic/nic_ncsi/hikp_nic_ncsi.c
+++ b/net/nic/nic_ncsi/hikp_nic_ncsi.c
@@ -89,6 +89,8 @@ static int nic_ncsi_cmd_get_port_info(struct major_cmd_ctrl *self, const char *a
 
 static int nic_ncsi_cmd_show_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
diff --git a/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c b/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c
index 4efaadc..c301dad 100644
--- a/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c
+++ b/net/nic/nic_notify_pkt/hikp_nic_notify_pkt.c
@@ -84,6 +84,8 @@ void hikp_nic_notify_pkt_cmd_execute(struct major_cmd_ctrl *self)
 
 static int hikp_nic_notify_pkt_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
diff --git a/net/nic/nic_ppp/hikp_nic_ppp.c b/net/nic/nic_ppp/hikp_nic_ppp.c
index 24f41ee..43a9000 100644
--- a/net/nic/nic_ppp/hikp_nic_ppp.c
+++ b/net/nic/nic_ppp/hikp_nic_ppp.c
@@ -66,6 +66,8 @@ void hikp_nic_ppp_set_cmd_param(int feature_idx)
 
 static int hikp_nic_ppp_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
@@ -788,6 +790,8 @@ static int hikp_nic_query_ppp_by_entryid(struct hikp_cmd_header *req_header,
 	const struct ppp_feature_cmd *ppp_cmd;
 	struct nic_ppp_req_para req_data = {0};
 
+	HIKP_SET_USED(len);
+
 	req_data.bdf = *bdf;
 	ppp_cmd = &g_ppp_feature_cmd[g_ppp_param.feature_idx];
 	if (strcmp(ppp_cmd->feature_name, NIC_PPP_MAC_TBL_NAME) == 0)
diff --git a/net/nic/nic_qos/hikp_nic_qos.c b/net/nic/nic_qos/hikp_nic_qos.c
index dc6f63e..6435f7c 100644
--- a/net/nic/nic_qos/hikp_nic_qos.c
+++ b/net/nic/nic_qos/hikp_nic_qos.c
@@ -45,6 +45,8 @@ void hikp_nic_qos_set_cmd_direction(enum nic_pfc_dir dir)
 
 static int hikp_nic_qos_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
diff --git a/net/nic/nic_queue/hikp_nic_queue.c b/net/nic/nic_queue/hikp_nic_queue.c
index 5bb4335..dae634f 100644
--- a/net/nic/nic_queue/hikp_nic_queue.c
+++ b/net/nic/nic_queue/hikp_nic_queue.c
@@ -42,6 +42,8 @@ void hikp_nic_queue_cmd_set_param(int feature_idx, int qid, enum nic_queue_dir d
 
 static int hikp_nic_queue_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
diff --git a/net/nic/nic_rss/hikp_nic_rss.c b/net/nic/nic_rss/hikp_nic_rss.c
index a7448e4..76cab8a 100644
--- a/net/nic/nic_rss/hikp_nic_rss.c
+++ b/net/nic/nic_rss/hikp_nic_rss.c
@@ -139,6 +139,8 @@ void hikp_nic_rss_cmd_set_feature_idx(int feature_idx)
 
 static int hikp_nic_rss_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
diff --git a/net/nic/nic_torus/hikp_nic_torus.c b/net/nic/nic_torus/hikp_nic_torus.c
index d5e22b1..7ad5211 100644
--- a/net/nic/nic_torus/hikp_nic_torus.c
+++ b/net/nic/nic_torus/hikp_nic_torus.c
@@ -148,6 +148,8 @@ void hikp_nic_torus_cmd_execute(struct major_cmd_ctrl *self)
 
 static int hikp_nic_torus_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <device>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
diff --git a/net/roce/roce_bond/hikp_roce_bond.c b/net/roce/roce_bond/hikp_roce_bond.c
index 5256804..244f29c 100644
--- a/net/roce/roce_bond/hikp_roce_bond.c
+++ b/net/roce/roce_bond/hikp_roce_bond.c
@@ -23,6 +23,8 @@ int hikp_roce_set_bond_bdf(char *nic_name)
 
 static int hikp_roce_bond_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -51,6 +53,8 @@ static int hikp_roce_bond_get_data(struct hikp_cmd_ret **cmd_ret,
 	uint32_t req_size;
 	int ret;
 
+	HIKP_SET_USED(reg_name);
+
 	req_data.bdf = g_roce_bond_param.target.bdf;
 	req_data.block_id = block_id;
 
diff --git a/net/roce/roce_caep/hikp_roce_caep.c b/net/roce/roce_caep/hikp_roce_caep.c
index 95795d1..290aa18 100644
--- a/net/roce/roce_caep/hikp_roce_caep.c
+++ b/net/roce/roce_caep/hikp_roce_caep.c
@@ -28,6 +28,8 @@ void hikp_roce_set_caep_mode(uint32_t mode)
 
 static int hikp_roce_caep_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -59,6 +61,8 @@ static int hikp_roce_caep_get_data(struct hikp_cmd_ret **cmd_ret,
 	uint32_t req_size;
 	int ret;
 
+	HIKP_SET_USED(reg_name);
+
 	req_data_ext.origin_param.bdf = g_roce_caep_param_t.target.bdf;
 	req_data_ext.block_id = block_id;
 
@@ -124,6 +128,9 @@ void hikp_roce_caep_execute(struct major_cmd_ctrl *self)
 
 static int hikp_roce_caep_ext_set(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_roce_caep_param_t.sub_cmd = CAEP_EXT;
 
 	return 0;
diff --git a/net/roce/roce_global_cfg/hikp_roce_global_cfg.c b/net/roce/roce_global_cfg/hikp_roce_global_cfg.c
index ca42dfa..8b0d93a 100644
--- a/net/roce/roce_global_cfg/hikp_roce_global_cfg.c
+++ b/net/roce/roce_global_cfg/hikp_roce_global_cfg.c
@@ -24,6 +24,8 @@ int hikp_roce_set_global_cfg_bdf(char *nic_name)
 static int hikp_roce_global_cfg_help(struct major_cmd_ctrl *self,
 				     const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -54,6 +56,8 @@ static int hikp_roce_global_cfg_get_data(struct hikp_cmd_ret **cmd_ret,
 	uint32_t req_size;
 	int ret;
 
+	HIKP_SET_USED(reg_name);
+
 	req_data.bdf = g_roce_global_cfg_param.target.bdf;
 	req_data.block_id = block_id;
 
@@ -81,7 +85,7 @@ void hikp_roce_global_cfg_execute(struct major_cmd_ctrl *self)
 		ROCE_GLB_TDP_M,
 		ROCE_GLB_NICL,
 	};
-	int i;
+	size_t i;
 
 	for (i = 0; i < HIKP_ARRAY_SIZE(sub_cmds); i++) {
 		g_roce_global_cfg_param.sub_cmd = sub_cmds[i];
diff --git a/net/roce/roce_gmv/hikp_roce_gmv.c b/net/roce/roce_gmv/hikp_roce_gmv.c
index 5f96451..92bead1 100644
--- a/net/roce/roce_gmv/hikp_roce_gmv.c
+++ b/net/roce/roce_gmv/hikp_roce_gmv.c
@@ -29,6 +29,8 @@ void hikp_roce_set_gmv_index(uint32_t gmv_index)
 
 static int hikp_roce_gmv_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -103,6 +105,8 @@ void hikp_roce_gmv_execute(struct major_cmd_ctrl *self)
 	uint32_t reg_num;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	req_data.bdf = g_roce_gmv_param.target.bdf;
 	req_data.gmv_index = g_roce_gmv_param.gmv_index;
 	hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_GMV_CMD, GMV_SHOW);
diff --git a/net/roce/roce_mdb/hikp_roce_mdb.c b/net/roce/roce_mdb/hikp_roce_mdb.c
index e0a7cc5..c0d028f 100644
--- a/net/roce/roce_mdb/hikp_roce_mdb.c
+++ b/net/roce/roce_mdb/hikp_roce_mdb.c
@@ -29,6 +29,8 @@ void hikp_roce_set_mdb_mode(uint8_t mode)
 
 static int hikp_roce_mdb_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -54,6 +56,9 @@ static int hikp_roce_mdb_target(struct major_cmd_ctrl *self, const char *argv)
 
 static int hikp_roce_mdb_clear_set(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_roce_mdb_param.flag |= ROCE_MDB_CMD_CLEAR;
 
 	return 0;
@@ -182,6 +187,9 @@ void hikp_roce_mdb_execute(struct major_cmd_ctrl *self)
 
 static int hikp_roce_mdb_ext_set(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_roce_mdb_param.flag |= ROCE_MDB_CMD_EXT;
 
 	return 0;
diff --git a/net/roce/roce_pkt/hikp_roce_pkt.c b/net/roce/roce_pkt/hikp_roce_pkt.c
index 5a6b268..1538788 100644
--- a/net/roce/roce_pkt/hikp_roce_pkt.c
+++ b/net/roce/roce_pkt/hikp_roce_pkt.c
@@ -23,6 +23,8 @@ int hikp_roce_set_pkt_bdf(char *nic_name)
 
 static int hikp_roce_pkt_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -47,6 +49,9 @@ static int hikp_roce_pkt_target(struct major_cmd_ctrl *self, const char *argv)
 
 static int hikp_roce_pkt_clear_set(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_roce_pkt_param_t.reset_flag = 1;
 	return 0;
 }
diff --git a/net/roce/roce_qmm/hikp_roce_qmm.c b/net/roce/roce_qmm/hikp_roce_qmm.c
index 30caa5a..af327c2 100644
--- a/net/roce/roce_qmm/hikp_roce_qmm.c
+++ b/net/roce/roce_qmm/hikp_roce_qmm.c
@@ -34,6 +34,8 @@ void hikp_roce_set_qmm_bankid(uint32_t bank_id)
 
 static int hikp_roce_qmm_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -208,7 +210,8 @@ static int hikp_roce_qmm_get_data(struct hikp_cmd_ret **cmd_ret,
 	struct roce_qmm_req_para_ext req_data_ext;
 	struct hikp_cmd_header req_header = { 0 };
 	uint32_t req_size;
-	int ret, i;
+	size_t i;
+	int ret;
 
 	if (reg_name) {
 		for (i = 0; i < HIKP_ARRAY_SIZE(g_qmm_reg_name_info_table); i++) {
@@ -277,7 +280,7 @@ void hikp_roce_qmm_execute(struct major_cmd_ctrl *self)
 		{QMM_SHOW_TOP, QMM_SHOW_TOP_EXT, "TOP"},
 	};
 
-	for (int i = 0; i < HIKP_ARRAY_SIZE(sub_cmd_info_table); i++) {
+	for (size_t i = 0; i < HIKP_ARRAY_SIZE(sub_cmd_info_table); i++) {
 		g_roce_qmm_param.sub_name = sub_cmd_info_table[i].sub_name;
 		if (g_roce_qmm_param.ext_flag) {
 			g_roce_qmm_param.sub_cmd = sub_cmd_info_table[i].sub_ext_cmd;
@@ -298,6 +301,9 @@ void hikp_roce_qmm_execute(struct major_cmd_ctrl *self)
 
 static int hikp_roce_qmm_ext_set(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_roce_qmm_param.ext_flag = true;
 
 	return 0;
diff --git a/net/roce/roce_rst/hikp_roce_rst.c b/net/roce/roce_rst/hikp_roce_rst.c
index cfccc47..c49074b 100644
--- a/net/roce/roce_rst/hikp_roce_rst.c
+++ b/net/roce/roce_rst/hikp_roce_rst.c
@@ -23,6 +23,8 @@ int hikp_roce_set_rst_bdf(char *nic_name)
 
 static int hikp_roce_rst_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -51,6 +53,8 @@ static int hikp_roce_rst_get_data(struct hikp_cmd_ret **cmd_ret,
 	uint32_t req_size;
 	int ret;
 
+	HIKP_SET_USED(reg_name);
+
 	req_data.bdf = g_roce_rst_param.target.bdf;
 	req_data.block_id = block_id;
 
diff --git a/net/roce/roce_scc/hikp_roce_scc.c b/net/roce/roce_scc/hikp_roce_scc.c
index c660799..67a2a1e 100644
--- a/net/roce/roce_scc/hikp_roce_scc.c
+++ b/net/roce/roce_scc/hikp_roce_scc.c
@@ -36,6 +36,8 @@ void hikp_roce_set_scc_submodule(uint32_t module)
 
 static int hikp_roce_scc_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -82,6 +84,9 @@ static int hikp_roce_scc_module_select(struct major_cmd_ctrl *self, const char *
 
 static int hikp_roce_scc_clear_set(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_roce_scc_param_t.reset_flag = 1;
 
 	return 0;
diff --git a/net/roce/roce_timer/hikp_roce_timer.c b/net/roce/roce_timer/hikp_roce_timer.c
index a6af959..927d8a6 100644
--- a/net/roce/roce_timer/hikp_roce_timer.c
+++ b/net/roce/roce_timer/hikp_roce_timer.c
@@ -23,6 +23,8 @@ int hikp_roce_set_timer_bdf(char *nic_name)
 
 static int hikp_roce_timer_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -46,6 +48,9 @@ static int hikp_roce_timer_target(struct major_cmd_ctrl *self, const char *argv)
 
 static int hikp_roce_timer_clear_set(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_roce_timer_param.flag = ROCE_TIMER_CMD_CLEAR;
 	return 0;
 }
@@ -120,6 +125,8 @@ static int hikp_roce_timer_show_qpc(struct major_cmd_ctrl *self)
 	struct hikp_cmd_ret *cmd_ret = NULL;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	req_data.bdf = g_roce_timer_param.target.bdf;
 	if (g_roce_timer_param.flag)
 		hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_TIMER_CMD, TIMER_QPC_CLEAR);
@@ -153,6 +160,8 @@ static int hikp_roce_timer_show_cqc(struct major_cmd_ctrl *self)
 	struct hikp_cmd_ret *cmd_ret = NULL;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	req_data.bdf = g_roce_timer_param.target.bdf;
 	if (g_roce_timer_param.flag)
 		hikp_cmd_init(&req_header, ROCE_MOD, GET_ROCEE_TIMER_CMD, TIMER_CQC_CLEAR);
@@ -204,7 +213,7 @@ void hikp_roce_timer_execute(struct major_cmd_ctrl *self)
 		hikp_roce_timer_show_cqc, hikp_roce_timer_show_qpc
 	};
 	const char *function[] = {"show cqc", "show qpc"};
-	int i = 0;
+	size_t i = 0;
 	int ret;
 
 	if (g_roce_timer_param.flag) {
diff --git a/net/roce/roce_trp/hikp_roce_trp.c b/net/roce/roce_trp/hikp_roce_trp.c
index 9b1ddb1..67dfb8e 100644
--- a/net/roce/roce_trp/hikp_roce_trp.c
+++ b/net/roce/roce_trp/hikp_roce_trp.c
@@ -39,6 +39,8 @@ void hikp_roce_set_trp_submodule(uint32_t module)
 
 static int hikp_roce_trp_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
diff --git a/net/roce/roce_tsp/hikp_roce_tsp.c b/net/roce/roce_tsp/hikp_roce_tsp.c
index e07e882..5fe2104 100644
--- a/net/roce/roce_tsp/hikp_roce_tsp.c
+++ b/net/roce/roce_tsp/hikp_roce_tsp.c
@@ -38,6 +38,8 @@ void hikp_roce_set_tsp_submodule(uint32_t module)
 
 static int hikp_roce_tsp_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -118,6 +120,9 @@ static int hikp_roce_tsp_bank_check(void)
 
 static int hikp_roce_tsp_clear_set(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_roce_tsp_param_t.reset_flag = 1;
 
 	return 0;
diff --git a/net/roh/hikp_roh_mac.c b/net/roh/hikp_roh_mac.c
index aa13f92..e16a3db 100644
--- a/net/roh/hikp_roh_mac.c
+++ b/net/roh/hikp_roh_mac.c
@@ -18,6 +18,8 @@ static struct roh_mac_param g_roh_mac_param = { 0 };
 
 static int hikp_roh_mac_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name,
 	       "-i <interface> -s <mac_type|cam|credit>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
@@ -96,7 +98,7 @@ int hikp_roh_get_mac_type(struct major_cmd_ctrl *self, struct bdf_t bdf)
 	return is_roh;
 }
 
-static void hikp_roh_show_mac_type(struct major_cmd_ctrl *self, int mac_type)
+static void hikp_roh_show_mac_type(int mac_type)
 {
 	if (mac_type)
 		printf("MAC_TYPE: ROH\n");
@@ -382,7 +384,7 @@ static void hikp_roh_mac_execute_entry(struct major_cmd_ctrl *self)
 			HIKP_ERROR_PRINT("Failed get current mac type\n");
 			return;
 		}
-		hikp_roh_show_mac_type(self, mac_type);
+		hikp_roh_show_mac_type(mac_type);
 		break;
 	case (CMD_SHOW_CAM_FLAG):
 		if (hikp_roh_is_roh(self) > 0)
diff --git a/net/roh/hikp_roh_show_bp.c b/net/roh/hikp_roh_show_bp.c
index 0b53eda..edc1dc6 100644
--- a/net/roh/hikp_roh_show_bp.c
+++ b/net/roh/hikp_roh_show_bp.c
@@ -17,6 +17,8 @@ static struct cmd_roh_show_bp_param g_roh_show_bp_param = { 0 };
 
 static int hikp_roh_show_bp_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface> -s\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -115,6 +117,9 @@ static void hikp_roh_show_bp_execute(struct major_cmd_ctrl *self)
 
 static int hikp_roh_show_bp_parse(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_roh_show_bp_param.flag |= ROH_CMD_SHOW_BP;
 	return 0;
 }
diff --git a/net/roh/hikp_roh_show_mib.c b/net/roh/hikp_roh_show_mib.c
index 5f03355..96dd688 100644
--- a/net/roh/hikp_roh_show_mib.c
+++ b/net/roh/hikp_roh_show_mib.c
@@ -151,6 +151,8 @@ static char g_roh_mac_mib_name[MIB_EVENT_COUNT][ROH_NAME_MAX] = {
 
 static int hikp_roh_show_mib_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface> -s\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
@@ -253,6 +255,9 @@ static void hikp_roh_show_mib_execute(struct major_cmd_ctrl *self)
 
 static int hikp_roh_show_mib_parse(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	roh_show_mib_param.flag |= ROH_CMD_SHOW_MIB;
 	return 0;
 }
diff --git a/net/ub/ub_bp/hikp_ub_bp.c b/net/ub/ub_bp/hikp_ub_bp.c
index 179aa22..2dfe69c 100644
--- a/net/ub/ub_bp/hikp_ub_bp.c
+++ b/net/ub/ub_bp/hikp_ub_bp.c
@@ -17,6 +17,8 @@ static struct ub_bp_param g_ub_bp_param = { 0 };
 
 static int hikp_ub_bp_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
diff --git a/net/ub/ub_crd/hikp_ub_crd.c b/net/ub/ub_crd/hikp_ub_crd.c
index 6d2ba21..678bc84 100644
--- a/net/ub/ub_crd/hikp_ub_crd.c
+++ b/net/ub/ub_crd/hikp_ub_crd.c
@@ -17,6 +17,8 @@ static struct ub_crd_param g_ub_crd_param = { 0 };
 
 static int hikp_ub_crd_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
diff --git a/net/ub/ub_dfx/hikp_ub_dfx.c b/net/ub/ub_dfx/hikp_ub_dfx.c
index dd3a713..8a3e293 100644
--- a/net/ub/ub_dfx/hikp_ub_dfx.c
+++ b/net/ub/ub_dfx/hikp_ub_dfx.c
@@ -44,6 +44,8 @@ static void dfx_help_info(const struct major_cmd_ctrl *self)
 
 static int hikp_ub_dfx_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	dfx_help_info(self);
 	return 0;
 }
diff --git a/net/ub/ub_info/hikp_ub_info.c b/net/ub/ub_info/hikp_ub_info.c
index d113f7c..ef58ff5 100644
--- a/net/ub/ub_info/hikp_ub_info.c
+++ b/net/ub/ub_info/hikp_ub_info.c
@@ -17,6 +17,8 @@ static struct ub_info_param g_ub_info_param = { 0 };
 
 static int hikp_ub_info_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
diff --git a/net/ub/ub_link/hikp_ub_link.c b/net/ub/ub_link/hikp_ub_link.c
index 1cc1879..801e56e 100644
--- a/net/ub/ub_link/hikp_ub_link.c
+++ b/net/ub/ub_link/hikp_ub_link.c
@@ -17,6 +17,8 @@ static struct ub_link_param g_ub_link_param = { 0 };
 
 static int hikp_ub_link_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>\n");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("  Options:\n\n");
diff --git a/net/ub/ub_ppp/hikp_unic_ppp.c b/net/ub/ub_ppp/hikp_unic_ppp.c
index 01c1624..4c48e70 100644
--- a/net/ub/ub_ppp/hikp_unic_ppp.c
+++ b/net/ub/ub_ppp/hikp_unic_ppp.c
@@ -39,6 +39,8 @@ static const struct unic_ppp_feature_cmd g_unic_ppp_feature_cmd[] = {
 
 static int hikp_unic_ppp_cmd_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name, "-i <interface>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("\n  Options:\n\n");
@@ -209,8 +211,7 @@ static int hikp_unic_ppp_alloc_guid_tbl_entry(const struct hikp_unic_ppp_hw_reso
 }
 
 static union unic_ppp_feature_info*
-hikp_unic_ppp_data_alloc(const struct unic_ppp_feature_cmd *unic_ppp_cmd,
-			 const struct hikp_unic_ppp_hw_resources *hw_res)
+hikp_unic_ppp_data_alloc(const struct hikp_unic_ppp_hw_resources *hw_res)
 {
 	union unic_ppp_feature_info *unic_ppp_data;
 	int ret = -1;
@@ -461,7 +462,7 @@ static void hikp_unic_ppp_cmd_execute(struct major_cmd_ctrl *self)
 	}
 
 	unic_ppp_cmd = &g_unic_ppp_feature_cmd[g_unic_ppp_param.feature_idx];
-	unic_ppp_data = hikp_unic_ppp_data_alloc(unic_ppp_cmd, &g_unic_ppp_hw_res);
+	unic_ppp_data = hikp_unic_ppp_data_alloc(&g_unic_ppp_hw_res);
 	if (unic_ppp_data == NULL) {
 		snprintf(self->err_str, sizeof(self->err_str),
 			 "failed to allocate unic_ppp_data memory!");
diff --git a/pcie/func_lib/pcie_func/pcie_reg_dump.c b/pcie/func_lib/pcie_func/pcie_reg_dump.c
index 0ce2e5d..4172637 100644
--- a/pcie/func_lib/pcie_func/pcie_reg_dump.c
+++ b/pcie/func_lib/pcie_func/pcie_reg_dump.c
@@ -446,7 +446,7 @@ static void pcie_dumpreg_write_value_to_file(const char *reg_name, uint32_t val)
 	int ret;
 
 	ret = snprintf(str, sizeof(str), "    %-40s : 0x%x\n", reg_name, val);
-	if (ret < 0 || ret >= sizeof(str)) {
+	if (ret < 0 || ret >= MAX_STR_LEN) {
 		Err("pcie dumpreg write info to logfile failed.\n");
 	} else {
 		wr_ret = write(g_pcie_dumpreg_fd, str, strlen(str));
diff --git a/pcie/usr_cmd/cmd_analysis/pcie_cmd_dumpreg.c b/pcie/usr_cmd/cmd_analysis/pcie_cmd_dumpreg.c
index 6d1c674..8ec0404 100644
--- a/pcie/usr_cmd/cmd_analysis/pcie_cmd_dumpreg.c
+++ b/pcie/usr_cmd/cmd_analysis/pcie_cmd_dumpreg.c
@@ -29,6 +29,8 @@ struct tool_pcie_cmd g_dumpreg_cmd = {
 
 static int pcie_dumpreg_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s\n", self->cmd_ptr->name);
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-i", "--interface", "please input port[x] first\n");
@@ -48,6 +50,8 @@ static int pcie_port_set(struct major_cmd_ctrl *self, const char *argv)
 	uint32_t val;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	ret = string_toui(argv, &val);
 	if (ret) {
 		printf("info set port id err %d.\n", ret);
@@ -63,6 +67,8 @@ static int dump_level_set(struct major_cmd_ctrl *self, const char *argv)
 	uint32_t val = 0;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	ret = string_toui(argv, &val);
 	if (ret || val < DUMP_GLOBAL_LEVEL || val > DUMP_PORT_LEVEL) {
 		printf("info set id err, ret = %d, val = %u\n", ret, val);
@@ -75,6 +81,9 @@ static int dump_level_set(struct major_cmd_ctrl *self, const char *argv)
 
 static int pcie_dumpreg_dump(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_dumpreg_cmd.cmd_type = DUMPREG_DUMP;
 
 	return 0;
diff --git a/pcie/usr_cmd/cmd_analysis/pcie_cmd_info.c b/pcie/usr_cmd/cmd_analysis/pcie_cmd_info.c
index aeab241..f3bd46f 100644
--- a/pcie/usr_cmd/cmd_analysis/pcie_cmd_info.c
+++ b/pcie/usr_cmd/cmd_analysis/pcie_cmd_info.c
@@ -26,6 +26,8 @@ struct tool_pcie_cmd g_info_cmd = {
 
 static int pcie_info_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s\n", self->cmd_ptr->name);
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-i", "--interface",
@@ -42,6 +44,9 @@ static int pcie_info_help(struct major_cmd_ctrl *self, const char *argv)
 
 static int pcie_distribution_show(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_info_cmd.cmd_type = INFO_DISTRIBUTION;
 
 	return 0;
@@ -49,6 +54,9 @@ static int pcie_distribution_show(struct major_cmd_ctrl *self, const char *argv)
 
 static int pcie_err_state_show(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_info_cmd.cmd_type = INFO_ERR_STATE_SHOW;
 
 	return 0;
@@ -56,6 +64,9 @@ static int pcie_err_state_show(struct major_cmd_ctrl *self, const char *argv)
 
 static int pcie_err_state_clear(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_info_cmd.cmd_type = INFO_ERR_STATE_CLEAR;
 
 	return 0;
@@ -66,6 +77,8 @@ static int pcie_port_chip_set(struct major_cmd_ctrl *self, const char *argv)
 	uint32_t val;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	ret = string_toui(argv, &val);
 	if (ret) {
 		printf("info set id err %d\n", ret);
diff --git a/pcie/usr_cmd/cmd_analysis/pcie_cmd_reg_read.c b/pcie/usr_cmd/cmd_analysis/pcie_cmd_reg_read.c
index 6e54516..a884604 100644
--- a/pcie/usr_cmd/cmd_analysis/pcie_cmd_reg_read.c
+++ b/pcie/usr_cmd/cmd_analysis/pcie_cmd_reg_read.c
@@ -32,6 +32,8 @@ struct tool_pcie_cmd g_regread_cmd = {
 
 static int pcie_reg_read_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s\n", self->cmd_ptr->name);
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-i", "--interface", "please input port[x] first\n");
@@ -50,6 +52,8 @@ static int pcie_port_set(struct major_cmd_ctrl *self, const char *argv)
 	uint32_t val;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	ret = string_toui(argv, &val);
 	if (ret) {
 		printf("info set port id err %d.\n", ret);
@@ -65,6 +69,8 @@ static int read_module_set(struct major_cmd_ctrl *self, const char *argv)
 	uint32_t val;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	ret = pcie_read_name2module_id(argv, &val);
 	if (ret) {
 		printf("undefined module \"%s\".\n", argv);
@@ -80,6 +86,8 @@ static int read_offset_set(struct major_cmd_ctrl *self, const char *argv)
 	uint32_t val;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	ret = string_toui(argv, &val);
 	if (ret) {
 		printf("info set offset err %d.\n", ret);
@@ -92,6 +100,9 @@ static int read_offset_set(struct major_cmd_ctrl *self, const char *argv)
 
 static int pcie_reg_read_exe(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_regread_cmd.cmd_type = REGRD_READ;
 
 	return 0;
diff --git a/pcie/usr_cmd/cmd_analysis/pcie_cmd_trace.c b/pcie/usr_cmd/cmd_analysis/pcie_cmd_trace.c
index 8ceb85a..7b0efde 100644
--- a/pcie/usr_cmd/cmd_analysis/pcie_cmd_trace.c
+++ b/pcie/usr_cmd/cmd_analysis/pcie_cmd_trace.c
@@ -27,6 +27,8 @@ struct tool_pcie_cmd g_trace_cmd = {
 
 static int pcie_trace_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s\n", self->cmd_ptr->name);
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-i", "--interface", "please input port[x]  first\n");
@@ -45,6 +47,9 @@ static int pcie_trace_help(struct major_cmd_ctrl *self, const char *argv)
 
 static int pcie_trace_clear(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_trace_cmd.cmd_type = TRACE_CLEAR;
 
 	return 0;
@@ -53,6 +58,9 @@ static int pcie_trace_clear(struct major_cmd_ctrl *self, const char *argv)
 
 static int pcie_trace_show(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_trace_cmd.cmd_type = TRACE_SHOW;
 
 	return 0;
@@ -60,6 +68,9 @@ static int pcie_trace_show(struct major_cmd_ctrl *self, const char *argv)
 
 static int pcie_pm_show(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_trace_cmd.cmd_type = TRACE_PM;
 
 	return 0;
@@ -70,6 +81,8 @@ static int pcie_trace_mode_set(struct major_cmd_ctrl *self, const char *argv)
 	int ret;
 	uint32_t val = 0;
 
+	HIKP_SET_USED(self);
+
 	g_trace_cmd.cmd_type = TRACE_MODE;
 	ret = string_toui(argv, &val);
 	if (ret || val > 1) {
@@ -83,6 +96,9 @@ static int pcie_trace_mode_set(struct major_cmd_ctrl *self, const char *argv)
 
 static int pcie_link_information_get(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_trace_cmd.cmd_type = TRACE_INFO;
 	return 0;
 }
@@ -92,6 +108,8 @@ static int pcie_port_id_set(struct major_cmd_ctrl *self, const char *argv)
 	uint32_t val;
 	int ret;
 
+	HIKP_SET_USED(self);
+
 	ret = string_toui(argv, &val);
 	if (ret) {
 		printf("trace set port id err %d\n", ret);
diff --git a/sas/sas_func/sas_analy_queue.c b/sas/sas_func/sas_analy_queue.c
index f1d2e7e..3411f67 100644
--- a/sas/sas_func/sas_analy_queue.c
+++ b/sas/sas_func/sas_analy_queue.c
@@ -46,7 +46,7 @@ static int sas_get_res(const struct tool_sas_cmd *cmd, uint32_t *reg_save, uint3
 		return -EINVAL;
 	}
 	*reg_num = cmd_ret->rsp_data_num;
-	for (int i = 0; i < *reg_num; i++)
+	for (uint32_t i = 0; i < *reg_num; i++)
 		reg_save[i] = cmd_ret->rsp_data[i];
 
 	hikp_cmd_free(&cmd_ret);
diff --git a/sas/sas_func/sas_dump_reg.c b/sas/sas_func/sas_dump_reg.c
index 39fa5ed..4269822 100644
--- a/sas/sas_func/sas_dump_reg.c
+++ b/sas/sas_func/sas_dump_reg.c
@@ -38,14 +38,14 @@ static int sas_get_reg(const struct tool_sas_cmd *cmd, uint32_t *reg_save, uint3
 		return -1;
 	}
 	*reg_num = cmd_ret->rsp_data_num;
-	for (int i = 0; i < *reg_num; i++)
+	for (uint32_t i = 0; i < *reg_num; i++)
 		reg_save[i] = cmd_ret->rsp_data[i];
 
 	hikp_cmd_free(&cmd_ret);
 	return 0;
 }
 
-static void sas_print_reg(uint32_t cmd_type, const uint32_t *reg_save, uint32_t reg_num)
+static void sas_print_reg(const uint32_t *reg_save, uint32_t reg_num)
 {
 	uint32_t i;
 
@@ -71,7 +71,7 @@ int sas_reg_dump(struct tool_sas_cmd *cmd)
 	if (ret)
 		return ret;
 
-	sas_print_reg(cmd->sas_cmd_type, reg_save, reg_num);
+	sas_print_reg(reg_save, reg_num);
 
 	return 0;
 }
diff --git a/sas/sas_func/sas_read_dev.c b/sas/sas_func/sas_read_dev.c
index b5d7e18..dec2935 100644
--- a/sas/sas_func/sas_read_dev.c
+++ b/sas/sas_func/sas_read_dev.c
@@ -22,7 +22,7 @@
 
 static int sas_get_dev(const struct tool_sas_cmd *cmd, uint32_t *reg_save, uint32_t *reg_num)
 {
-	int i;
+	uint32_t i;
 	struct hikp_cmd_header req_header;
 	struct hikp_cmd_ret *cmd_ret;
 	struct sas_dev_req_para req_data = { 0 };
@@ -46,7 +46,7 @@ static int sas_get_dev(const struct tool_sas_cmd *cmd, uint32_t *reg_save, uint3
 	return 0;
 }
 
-static void print_dev_link(const uint32_t *reg_save, uint32_t reg_num)
+static void print_dev_link(const uint32_t *reg_save)
 {
 	uint32_t i;
 	uint32_t index, index1;
@@ -84,7 +84,7 @@ static void sas_print_dev(const uint32_t *reg_save, uint32_t reg_num, uint32_t c
 	}
 	switch (cmd_type) {
 	case DEV_LINK:
-		print_dev_link(reg_save, reg_num);
+		print_dev_link(reg_save);
 		break;
 	default:
 		printf("cmd_type is error\n");
diff --git a/sas/sas_func/sas_read_dqe.c b/sas/sas_func/sas_read_dqe.c
index dac2546..ae4ef68 100644
--- a/sas/sas_func/sas_read_dqe.c
+++ b/sas/sas_func/sas_read_dqe.c
@@ -39,14 +39,14 @@ static int sas_get_dqe(const struct tool_sas_cmd *cmd, uint32_t *reg_save, uint3
 		return -EINVAL;
 	}
 	*reg_num = cmd_ret->rsp_data_num;
-	for (int i = 0; i < *reg_num; i++)
+	for (uint32_t i = 0; i < *reg_num; i++)
 		reg_save[i] = cmd_ret->rsp_data[i];
 
 	hikp_cmd_free(&cmd_ret);
 	return 0;
 }
 
-static void print_dqe_info(const void *reg_save, uint32_t reg_num)
+static void print_dqe_info(const void *reg_save)
 {
 	volatile struct hisi_sas_dq_info *dqe = (volatile struct hisi_sas_dq_info *)(reg_save);
 
@@ -109,6 +109,6 @@ int sas_dqe(const struct tool_sas_cmd *cmd)
 		printf("SAS dqe is failed\n");
 		return -EINVAL;
 	}
-	print_dqe_info(reg_save, reg_num);
+	print_dqe_info(reg_save);
 	return 0;
 }
diff --git a/sas/sas_func/sas_read_errcode.c b/sas/sas_func/sas_read_errcode.c
index d451a98..8263550 100644
--- a/sas/sas_func/sas_read_errcode.c
+++ b/sas/sas_func/sas_read_errcode.c
@@ -37,7 +37,7 @@ static int sas_get_errcode(const struct tool_sas_cmd *cmd, uint32_t *reg_save, u
 		return -EINVAL;
 	}
 	*reg_num = cmd_ret->rsp_data_num;
-	for (int i = 0; i < *reg_num; i++)
+	for (uint32_t i = 0; i < *reg_num; i++)
 		reg_save[i] = cmd_ret->rsp_data[i];
 
 	hikp_cmd_free(&cmd_ret);
diff --git a/sas/user_cmd/cmd_code/sas_cmd_anacq.c b/sas/user_cmd/cmd_code/sas_cmd_anacq.c
index 46bf5aa..bdaaa42 100644
--- a/sas/user_cmd/cmd_code/sas_cmd_anacq.c
+++ b/sas/user_cmd/cmd_code/sas_cmd_anacq.c
@@ -19,6 +19,8 @@
 
 static int sas_anacq_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s\n", self->cmd_ptr->name);
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-c", "--chipid", "please input chip id[x]  first\n");
@@ -34,11 +36,17 @@ static int sas_anacq_help(struct major_cmd_ctrl *self, const char *argv)
 
 static int sas_anacq_prt(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	return sas_set_cmd_type(ANACQ_PRT);
 }
 
 static int sas_anacq_num(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	return sas_set_cmd_type(ANACQ_NUM);
 }
 
diff --git a/sas/user_cmd/cmd_code/sas_cmd_anadq.c b/sas/user_cmd/cmd_code/sas_cmd_anadq.c
index e1b68b6..bff2c71 100644
--- a/sas/user_cmd/cmd_code/sas_cmd_anadq.c
+++ b/sas/user_cmd/cmd_code/sas_cmd_anadq.c
@@ -19,6 +19,8 @@
 
 static int sas_anadq_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s\n", self->cmd_ptr->name);
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-c", "--chipid", "please input chip id[x]  first\n");
@@ -34,11 +36,17 @@ static int sas_anadq_help(struct major_cmd_ctrl *self, const char *argv)
 
 static int sas_anadq_prt(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	return sas_set_cmd_type(ANADQ_PRT);
 }
 
 static int sas_anadq_num(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	return sas_set_cmd_type(ANADQ_NUM);
 }
 
diff --git a/sas/user_cmd/cmd_code/sas_cmd_common.c b/sas/user_cmd/cmd_code/sas_cmd_common.c
index 7d4ffbb..1dafc0a 100644
--- a/sas/user_cmd/cmd_code/sas_cmd_common.c
+++ b/sas/user_cmd/cmd_code/sas_cmd_common.c
@@ -23,7 +23,7 @@ static struct tool_sas_cmd g_sas_cmd = {
 	.dqe_id = (uint32_t)(-1),
 };
 
-int sas_set_id(struct major_cmd_ctrl *self, const char *argv, uint32_t *id)
+static int sas_set_id(struct major_cmd_ctrl *self, const char *argv, uint32_t *id)
 {
 	int ret;
 	uint32_t val = 0;
diff --git a/sas/user_cmd/cmd_code/sas_cmd_dev.c b/sas/user_cmd/cmd_code/sas_cmd_dev.c
index 6a5eae0..879e764 100644
--- a/sas/user_cmd/cmd_code/sas_cmd_dev.c
+++ b/sas/user_cmd/cmd_code/sas_cmd_dev.c
@@ -19,6 +19,8 @@
 
 static int sas_dev_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s\n", self->cmd_ptr->name);
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-c", "--chipid", "please input chip id[x]  first\n");
@@ -33,6 +35,9 @@ static int sas_dev_help(struct major_cmd_ctrl *self, const char *argv)
 
 static int sas_dev_link(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	return sas_set_cmd_type(DEV_LINK);
 }
 
diff --git a/sas/user_cmd/cmd_code/sas_cmd_dqe.c b/sas/user_cmd/cmd_code/sas_cmd_dqe.c
index 26bf0eb..5a85468 100644
--- a/sas/user_cmd/cmd_code/sas_cmd_dqe.c
+++ b/sas/user_cmd/cmd_code/sas_cmd_dqe.c
@@ -19,6 +19,8 @@
 
 static int sas_dqe_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s\n", self->cmd_ptr->name);
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-c", "--chipid", "please input chip id[x]  first\n");
@@ -57,7 +59,7 @@ static int sas_set_queue_id(struct major_cmd_ctrl *self, const char *argv)
 
 static int sas_dqe_excute_funs_call(uint32_t cmd_type)
 {
-	if ((cmd_type != SAS_UNKNOW_CMD) && (sas_get_que_id() != (uint32_t)(-1)))
+	if ((cmd_type != SAS_UNKNOW_CMD) && (sas_get_que_id() != (-1)))
 		return sas_dqe(sas_get_cmd_p());
 
 	return -EINVAL;
diff --git a/sas/user_cmd/cmd_code/sas_cmd_dump.c b/sas/user_cmd/cmd_code/sas_cmd_dump.c
index e7dedf0..db7d2c8 100644
--- a/sas/user_cmd/cmd_code/sas_cmd_dump.c
+++ b/sas/user_cmd/cmd_code/sas_cmd_dump.c
@@ -19,6 +19,8 @@
 
 static int sas_dump_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s\n", self->cmd_ptr->name);
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-c", "--chipid", "please input chip id[x]  first\n");
@@ -35,6 +37,9 @@ static int sas_dump_help(struct major_cmd_ctrl *self, const char *argv)
 
 static int sas_dump_global(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	(void)sas_set_cmd_type(DUMP_GLOBAL);
 	return 0;
 }
@@ -56,6 +61,9 @@ static int sas_dump_phyx(struct major_cmd_ctrl *self, char const *argv)
 
 static int sas_dump_axi(struct major_cmd_ctrl *self, char const *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	(void)sas_set_cmd_type(DUMP_AXI);
 	return 0;
 }
diff --git a/sas/user_cmd/cmd_code/sas_cmd_errcode.c b/sas/user_cmd/cmd_code/sas_cmd_errcode.c
index eb3c5e6..ebe7d1c 100644
--- a/sas/user_cmd/cmd_code/sas_cmd_errcode.c
+++ b/sas/user_cmd/cmd_code/sas_cmd_errcode.c
@@ -18,6 +18,8 @@
 
 static int sas_errcode_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s\n", self->cmd_ptr->name);
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-c", "--chipid", "please input chip id[x]  first\n");
diff --git a/sata/sata_func/sata_dump_reg.c b/sata/sata_func/sata_dump_reg.c
index d63a14b..d9911d6 100644
--- a/sata/sata_func/sata_dump_reg.c
+++ b/sata/sata_func/sata_dump_reg.c
@@ -46,7 +46,7 @@ static int sata_get_reg(const struct tool_sata_cmd *cmd, uint32_t *reg_save, uin
 	return 0;
 }
 
-static void sata_print_reg(uint32_t cmd_type, const uint32_t *reg_save, uint32_t reg_num)
+static void sata_print_reg(const uint32_t *reg_save, uint32_t reg_num)
 {
 	uint32_t i;
 
@@ -72,7 +72,7 @@ int sata_reg_dump(struct tool_sata_cmd *cmd)
 	if (ret)
 		return ret;
 
-	sata_print_reg(cmd->sata_cmd_type, sata_reg_save, sata_reg_num);
+	sata_print_reg(sata_reg_save, sata_reg_num);
 
 	return 0;
 }
diff --git a/sata/user_cmd/cmd_code/sata_cmd_dump.c b/sata/user_cmd/cmd_code/sata_cmd_dump.c
index d38ff1c..2b74712 100644
--- a/sata/user_cmd/cmd_code/sata_cmd_dump.c
+++ b/sata/user_cmd/cmd_code/sata_cmd_dump.c
@@ -26,6 +26,8 @@ struct tool_sata_cmd g_sata_dump_cmd = {
 
 static int sata_dump_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s\n", self->cmd_ptr->name);
 	printf("\n         %s\n", self->cmd_ptr->help_info);
 	printf("    %s, %-25s %s\n", "-c", "--chipid", "please input chip id[x]  first\n");
@@ -56,16 +58,25 @@ static int sata_set_id(struct major_cmd_ctrl *self, const char *argv, uint32_t *
 
 static int sata_set_chip_id(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	return sata_set_id(self, argv, &g_sata_dump_cmd.chip_id);
 }
 
 static int sata_set_die_id(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	return sata_set_id(self, argv, &g_sata_dump_cmd.die_id);
 }
 
 static int sata_dump_global(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_sata_dump_cmd.sata_cmd_type = DUMP_GLOBAL;
 	return 0;
 }
diff --git a/serdes/hikp_serdes.c b/serdes/hikp_serdes.c
index 2367382..01776df 100644
--- a/serdes/hikp_serdes.c
+++ b/serdes/hikp_serdes.c
@@ -31,6 +31,8 @@ static void hikp_serdes_dump_print(struct cmd_serdes_param *cmd);
 
 static int cmd_serdes_maininfo_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name,
 	       "-i <chipid> -s <start_lane_id> -n <lane_num> [-k]");
 	printf("\n         %s, e.g. hikptool serdes_info -i 0 -s m3d0 -n 4 -k\n",
@@ -119,6 +121,9 @@ static int cmd_serdes_lane_num(struct major_cmd_ctrl *self, const char *argv)
 
 static int cmd_serdes_key_info_pro(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(self);
+	HIKP_SET_USED(argv);
+
 	g_serdes_param.sub_cmd = 1;
 	return 0;
 }
@@ -379,6 +384,8 @@ static void cmd_serdes_maininfo_init(void)
 
 static int cmd_serdes_dump_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name,
 	       "-c <subcmd> -i <chipid> -s <start_lane_id>");
 	printf("\n         %s, e.g. hikptool serdes_dump -c cs -i 0 -s m0d0\n",
diff --git a/socip/hikp_socip_dumpreg.c b/socip/hikp_socip_dumpreg.c
index a3a20cb..b3b3ed7 100644
--- a/socip/hikp_socip_dumpreg.c
+++ b/socip/hikp_socip_dumpreg.c
@@ -39,6 +39,8 @@ static struct dump_reg_param_t g_dump_reg_param[SOCIP_DUMP_REG_PARAM_NUM] = {0};
 
 static int cmd_socip_dump_help(struct major_cmd_ctrl *self, const char *argv)
 {
+	HIKP_SET_USED(argv);
+
 	printf("\n  Usage: %s %s\n", self->cmd_ptr->name,
 	       "-c <chipid> -d <dieid> -m <module_id> -i <controller_id>");
 	printf("\n         %s\n", self->cmd_ptr->help_info);
diff --git a/tool_lib/op_logs.c b/tool_lib/op_logs.c
index 6f28ecd..c1c7d02 100644
--- a/tool_lib/op_logs.c
+++ b/tool_lib/op_logs.c
@@ -246,7 +246,7 @@ int op_log_initialise(const char *log_dir)
 	memset(log_path, '\0', OP_LOG_FILE_PATH_MAXLEN);
 	memset(g_op_log, '\0', OP_LOG_FILE_PATH_MAXLEN);
 	ret = snprintf(log_path, sizeof(log_path), "%s", log_dir);
-	if (ret < 0 || ret >= sizeof(log_path))
+	if (ret < 0 || (size_t)ret >= sizeof(log_path))
 		return -EINVAL;
 
 	if (!is_dir_exist(log_path)) {
@@ -275,22 +275,17 @@ int op_log_initialise(const char *log_dir)
 void op_log_record_input(const int argc, const char **argv)
 {
 	char input_str[OP_LOG_FILE_W_MAXSIZE + 1] = {0};
-	struct op_log_print_t log_info[] = {
-		{"%s", g_cmd_exec_time},
-		{"[%s]", input_str},
-	};
-	size_t i, arr_size;
 	int offset = 0;
 	char *arg;
 	int ret;
 
 	memset(g_input_buf, 0, sizeof(g_input_buf));
 
-	if (argv == NULL || argc == 0)
+	if (argv == NULL || argc <= 0)
 		return;
 
 	arg = input_str;
-	for (i = 0; i < argc; i++) {
+	for (int i = 0; i < argc; i++) {
 		ret = snprintf(arg, (sizeof(input_str) - (arg - input_str)), "%s ", argv[i]);
 		if (ret < 0 || ret >= (int)(sizeof(input_str) - (arg - input_str)))
 			return;
@@ -299,15 +294,18 @@ void op_log_record_input(const int argc, const char **argv)
 	}
 	input_str[strlen(input_str) - 1] = 0;
 
-	arr_size = HIKP_ARRAY_SIZE(log_info);
-	for (i = 0; i < arr_size; i++) {
-		ret = snprintf(g_input_buf + offset, (OP_LOG_FILE_W_MAXSIZE + 1 - offset),
-			log_info[i].format, log_info[i].str);
-		if (ret < 0 || ret >= (OP_LOG_FILE_W_MAXSIZE + 1 - offset))
-			return;
-
-		offset += ret;
+	ret = snprintf(g_input_buf + offset, (OP_LOG_FILE_W_MAXSIZE + 1 - offset),
+		       "%s", g_cmd_exec_time);
+	if (ret < 0 || ret >= (OP_LOG_FILE_W_MAXSIZE + 1 - offset)) {
+		printf("snprintf exec time failed, ret 0x%x\n", ret);
+		return;
 	}
+
+	offset += ret;
+	ret = snprintf(g_input_buf + offset, (OP_LOG_FILE_W_MAXSIZE + 1 - offset),
+		       "[%s]", input_str);
+	if (ret < 0 || ret >= (OP_LOG_FILE_W_MAXSIZE + 1 - offset))
+		printf("snprintf exec cmd failed, ret 0x%x\n", ret);
 }
 
 void op_log_record_result(int ret, const char *tool_name, const char *log_dir)
@@ -393,7 +391,7 @@ static int signal_fcntl(const char *name, uint32_t operation, int *fd)
 	return uda_fcntl(lock_file, operation, fd);
 }
 
-void signal_op_log_write(int signal_code)
+static void signal_op_log_write(int signal_code)
 {
 	char log_str[] = "[00:00:00] [KILLED<00>].\r\n";
 	int op_log_fd;
diff --git a/tool_lib/tool_lib.c b/tool_lib/tool_lib.c
index 62f5fbb..3dc5dad 100644
--- a/tool_lib/tool_lib.c
+++ b/tool_lib/tool_lib.c
@@ -245,7 +245,7 @@ int tool_flock(const char *name, uint32_t operation, int *fd, const char *log_di
 	}
 
 	ret = snprintf(lock_file, sizeof(lock_file), "%s", log_dir);
-	if (ret < 0 || ret >= sizeof(lock_file)) {
+	if (ret < 0 || (size_t)ret >= sizeof(lock_file)) {
 		HIKP_ERROR_PRINT("generate flock [%s] folder name failed, errno is %d\n",
 				 log_dir, errno);
 		return -errno;
diff --git a/tool_lib/tool_lib.h b/tool_lib/tool_lib.h
index 3bf7bf8..24b1fbb 100644
--- a/tool_lib/tool_lib.h
+++ b/tool_lib/tool_lib.h
@@ -90,6 +90,10 @@ struct type_trans {
 #define HIKP_WARN_PRINT(x, args...) HIKP_LOG_PRINT("[ WARN ] " x, ##args)
 #define HIKP_INFO_PRINT(x, args...) HIKP_LOG_PRINT("[ INFO ] " x, ##args)
 #define HIKP_DBG_PRINT(x, args...) HIKP_LOG_PRINT("[ DBG ] " x, ##args)
+
+/* definition to mark a variable or function parameter as used so
+ * as to avoid a compiler warning
+ */
 #define HIKP_SET_USED(x) (void)(x)
 
 #define MIDR_EL1_PATH "/sys/devices/system/cpu/cpu0/regs/identification/midr_el1"
-- 
2.45.0.windows.1

