Fix some issues with ROH, PCIE and NIC modules Update tool version number to 1.1.1 (release version 14) Signed-off-by: veega2022 <zhuweijia@huawei.com> (cherry picked from commit 8e254c0769bc0a221ff0dcce0d022e5e76550bb6)
80 lines
2.7 KiB
Diff
80 lines
2.7 KiB
Diff
From 84eb49f12133a4938805462940eaa2847492bdfb Mon Sep 17 00:00:00 2001
|
|
From: veega2022 <zhuweijia@huawei.com>
|
|
Date: Wed, 28 Feb 2024 11:23:59 +0800
|
|
Subject: [PATCH] hikptool: fix cleancode codecheck alarm
|
|
|
|
1. invalid case style for macro definition __HIKPTDEV_PLUG_H
|
|
fix it to HIKPTDEV_PLUG_H
|
|
|
|
2. Please do not mix signed and unsigned numbers
|
|
Modify the operator to ensure that the types on both sides are consistent.
|
|
|
|
Signed-off-by: veega2022 <zhuweijia@huawei.com>
|
|
---
|
|
libhikptdev/include/hikptdev_plug.h | 6 +++---
|
|
tool_lib/op_logs.c | 2 +-
|
|
tool_lib/tool_lib.c | 4 ++--
|
|
3 files changed, 6 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/libhikptdev/include/hikptdev_plug.h b/libhikptdev/include/hikptdev_plug.h
|
|
index 34fd783..8b242d3 100644
|
|
--- a/libhikptdev/include/hikptdev_plug.h
|
|
+++ b/libhikptdev/include/hikptdev_plug.h
|
|
@@ -11,8 +11,8 @@
|
|
* See the Mulan PSL v2 for more details.
|
|
*/
|
|
|
|
-#ifndef __HIKPTDEV_PLUG_H
|
|
-#define __HIKPTDEV_PLUG_H
|
|
+#ifndef HIKPTDEV_PLUG_H
|
|
+#define HIKPTDEV_PLUG_H
|
|
|
|
#include <stdint.h>
|
|
|
|
@@ -57,4 +57,4 @@ void hikp_dev_uninit(void);
|
|
int hikp_rsp_normal_check(const struct hikp_cmd_ret *cmd_ret);
|
|
int hikp_rsp_normal_check_with_version(const struct hikp_cmd_ret *cmd_ret, uint32_t version);
|
|
|
|
-#endif
|
|
+#endif /* HIKPTDEV_PLUG_H */
|
|
diff --git a/tool_lib/op_logs.c b/tool_lib/op_logs.c
|
|
index f57f5fd..9fb91d8 100644
|
|
--- a/tool_lib/op_logs.c
|
|
+++ b/tool_lib/op_logs.c
|
|
@@ -283,7 +283,7 @@ void op_log_record_input(const int argc, const char **argv)
|
|
arg = input_str;
|
|
for (i = 0; i < argc; i++) {
|
|
ret = snprintf(arg, (sizeof(input_str) - (arg - input_str)), "%s ", argv[i]);
|
|
- if (ret < 0 || ret >= (sizeof(input_str) - (arg - input_str)))
|
|
+ if (ret < 0 || ret >= (int)(sizeof(input_str) - (arg - input_str)))
|
|
return;
|
|
|
|
arg = arg + strlen(argv[i]) + 1;
|
|
diff --git a/tool_lib/tool_lib.c b/tool_lib/tool_lib.c
|
|
index 180418f..5c1a02d 100644
|
|
--- a/tool_lib/tool_lib.c
|
|
+++ b/tool_lib/tool_lib.c
|
|
@@ -281,9 +281,9 @@ static int get_rand_str(char *str, int length)
|
|
[TYPE_LOWERCASE] = {'a', 26},
|
|
};
|
|
uint32_t r[RANDOM_NUM];
|
|
+ uint32_t type;
|
|
int fd, size;
|
|
int i, j;
|
|
- int type;
|
|
|
|
fd = open("/dev/urandom", O_RDONLY);
|
|
if (fd < 0) {
|
|
@@ -325,7 +325,7 @@ int generate_file_name(unsigned char *file_name,
|
|
ret = snprintf((char *)file_name, file_name_len, "%s_%d_%d_%d_%d_%d_%d_%s.log", prefix,
|
|
timeinfo.tm_year + START_YEAR, timeinfo.tm_mon + 1, timeinfo.tm_mday,
|
|
timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec, str_r);
|
|
- if (ret < 0 || ret >= file_name_len) {
|
|
+ if (ret < 0 || (uint32_t)ret >= file_name_len) {
|
|
HIKP_ERROR_PRINT("generate file name failed, errno is %d\n", errno);
|
|
return -errno;
|
|
}
|
|
--
|
|
2.30.0
|
|
|