115 lines
3.6 KiB
Diff
115 lines
3.6 KiB
Diff
|
|
From ad9c1bc8ea907d6faebfb916916b5f898a8e0518 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Xiaofei Tan <tanxiaofei@huawei.com>
|
||
|
|
Date: Tue, 30 May 2023 11:44:12 +0100
|
||
|
|
Subject: [PATCH 2/3] rasdaemon: fix issue of signed and unsigned integer
|
||
|
|
comparison and remove redundant header file
|
||
|
|
|
||
|
|
1. The return value of ARRAY_SIZE() is unsigned integer. It isn't right to
|
||
|
|
compare it with a signed integer. This patch fix them.
|
||
|
|
|
||
|
|
2. Remove redundant header file and adjust the header files sequence.
|
||
|
|
|
||
|
|
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
|
||
|
|
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
|
||
|
|
---
|
||
|
|
non-standard-hisi_hip08.c | 2 +-
|
||
|
|
non-standard-hisilicon.c | 8 ++++----
|
||
|
|
ras-diskerror-handler.c | 2 +-
|
||
|
|
ras-memory-failure-handler.c | 7 +++----
|
||
|
|
4 files changed, 9 insertions(+), 10 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/non-standard-hisi_hip08.c b/non-standard-hisi_hip08.c
|
||
|
|
index 4ef47ea..61f12eb 100644
|
||
|
|
--- a/non-standard-hisi_hip08.c
|
||
|
|
+++ b/non-standard-hisi_hip08.c
|
||
|
|
@@ -1029,7 +1029,7 @@ static struct ras_ns_ev_decoder hip08_ns_ev_decoder[] = {
|
||
|
|
|
||
|
|
static void __attribute__((constructor)) hip08_init(void)
|
||
|
|
{
|
||
|
|
- int i;
|
||
|
|
+ unsigned int i;
|
||
|
|
|
||
|
|
for (i = 0; i < ARRAY_SIZE(hip08_ns_ev_decoder); i++)
|
||
|
|
register_ns_ev_decoder(&hip08_ns_ev_decoder[i]);
|
||
|
|
diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c
|
||
|
|
index 6ee9271..0d5fe6b 100644
|
||
|
|
--- a/non-standard-hisilicon.c
|
||
|
|
+++ b/non-standard-hisilicon.c
|
||
|
|
@@ -362,13 +362,13 @@ static int decode_hisi_common_section(struct ras_events *ras,
|
||
|
|
trace_seq_printf(s, "%s\n", hevent.error_msg);
|
||
|
|
|
||
|
|
if (err->val_bits & BIT(HISI_COMMON_VALID_REG_ARRAY_SIZE) && err->reg_array_size > 0) {
|
||
|
|
- int i;
|
||
|
|
+ unsigned int i;
|
||
|
|
|
||
|
|
trace_seq_printf(s, "Register Dump:\n");
|
||
|
|
for (i = 0; i < err->reg_array_size / sizeof(uint32_t); i++) {
|
||
|
|
- trace_seq_printf(s, "reg%02d=0x%08x\n", i,
|
||
|
|
+ trace_seq_printf(s, "reg%02u=0x%08x\n", i,
|
||
|
|
err->reg_array[i]);
|
||
|
|
- HISI_SNPRINTF(hevent.reg_msg, "reg%02d=0x%08x",
|
||
|
|
+ HISI_SNPRINTF(hevent.reg_msg, "reg%02u=0x%08x",
|
||
|
|
i, err->reg_array[i]);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
@@ -394,7 +394,7 @@ static struct ras_ns_ev_decoder hisi_section_ns_ev_decoder[] = {
|
||
|
|
|
||
|
|
static void __attribute__((constructor)) hisi_ns_init(void)
|
||
|
|
{
|
||
|
|
- int i;
|
||
|
|
+ unsigned int i;
|
||
|
|
|
||
|
|
for (i = 0; i < ARRAY_SIZE(hisi_section_ns_ev_decoder); i++)
|
||
|
|
register_ns_ev_decoder(&hisi_section_ns_ev_decoder[i]);
|
||
|
|
diff --git a/ras-diskerror-handler.c b/ras-diskerror-handler.c
|
||
|
|
index b16319f..b46f859 100644
|
||
|
|
--- a/ras-diskerror-handler.c
|
||
|
|
+++ b/ras-diskerror-handler.c
|
||
|
|
@@ -52,7 +52,7 @@ static const struct {
|
||
|
|
|
||
|
|
static const char *get_blk_error(int err)
|
||
|
|
{
|
||
|
|
- int i;
|
||
|
|
+ unsigned int i;
|
||
|
|
|
||
|
|
for (i = 0; i < ARRAY_SIZE(blk_errors); i++)
|
||
|
|
if (blk_errors[i].error == err)
|
||
|
|
diff --git a/ras-memory-failure-handler.c b/ras-memory-failure-handler.c
|
||
|
|
index 9941e68..8fd7117 100644
|
||
|
|
--- a/ras-memory-failure-handler.c
|
||
|
|
+++ b/ras-memory-failure-handler.c
|
||
|
|
@@ -15,11 +15,10 @@
|
||
|
|
#include <stdio.h>
|
||
|
|
#include <stdlib.h>
|
||
|
|
#include <string.h>
|
||
|
|
-#include "libtrace/kbuffer.h"
|
||
|
|
-#include "ras-memory-failure-handler.h"
|
||
|
|
#include "ras-record.h"
|
||
|
|
#include "ras-logger.h"
|
||
|
|
#include "ras-report.h"
|
||
|
|
+#include "ras-memory-failure-handler.h"
|
||
|
|
|
||
|
|
/* Memory failure - various types of pages */
|
||
|
|
enum mf_action_page_type {
|
||
|
|
@@ -99,7 +98,7 @@ static const struct {
|
||
|
|
|
||
|
|
static const char *get_page_type(int page_type)
|
||
|
|
{
|
||
|
|
- int i;
|
||
|
|
+ unsigned int i;
|
||
|
|
|
||
|
|
for (i = 0; i < ARRAY_SIZE(mf_page_type); i++)
|
||
|
|
if (mf_page_type[i].type == page_type)
|
||
|
|
@@ -110,7 +109,7 @@ static const char *get_page_type(int page_type)
|
||
|
|
|
||
|
|
static const char *get_action_result(int result)
|
||
|
|
{
|
||
|
|
- int i;
|
||
|
|
+ unsigned int i;
|
||
|
|
|
||
|
|
for (i = 0; i < ARRAY_SIZE(mf_action_result); i++)
|
||
|
|
if (mf_action_result[i].result == result)
|
||
|
|
--
|
||
|
|
2.25.1
|
||
|
|
|