From: Mauro Carvalho Chehab Date: Mon, 18 Nov 2024 15:13:50 +0000 (+0100) Subject: rasdaemon: don't use braces for single statement blocks X-Git-Tag: v0.8.2~14 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b7f6da3661a2a46c7a4cfc89945bcf1959f09975;p=users%2Fmchehab%2Frasdaemon.git rasdaemon: don't use braces for single statement blocks Solve those checkpatch warnings: WARNING: braces {} are not necessary for single statement blocks + if (clock_gettime(clk_id, &ts) == 0 && !strcmp(ev.error_type, "Corrected")) { + ras_record_row_error(ev.driver_detail, ev.error_count, ts.tv_sec, ev.address); + } total: 0 errors, 1 warnings, 0 checks, 304 lines checked WARNING: braces {} are not necessary for single statement blocks + if (!matched) { + log(TERM, LOG_INFO, "Improper %s, set to default off\n", env); + } WARNING: braces {} are not necessary for any arm of this statement + if (rr1->type == GHES) { [...] + } else { [...] WARNING: braces {} are not necessary for single statement blocks + for (int i = 0; i < ROW_LOCATION_FIELDS_NUM; i++) { + dst->location_fields[i] = src->location_fields[i]; + } Signed-off-by: Mauro Carvalho Chehab --- diff --git a/ras-mc-handler.c b/ras-mc-handler.c index 1346e0f..d8e5d0d 100644 --- a/ras-mc-handler.c +++ b/ras-mc-handler.c @@ -276,9 +276,9 @@ int ras_mc_event_handler(struct trace_seq *s, // even if the error_count is reported 0. if (ev.error_count == 0) ev.error_count = 1; - if (clock_gettime(clk_id, &ts) == 0 && !strcmp(ev.error_type, "Corrected")) { - ras_record_row_error(ev.driver_detail, ev.error_count, ts.tv_sec, ev.address); - } + if (clock_gettime(clk_id, &ts) == 0 && !strcmp(ev.error_type, "Corrected")) + ras_record_row_error(ev.driver_detail, ev.error_count, + ts.tv_sec, ev.address); #endif #ifdef HAVE_ABRT_REPORT diff --git a/ras-page-isolation.c b/ras-page-isolation.c index eb1f3a9..dc58710 100644 --- a/ras-page-isolation.c +++ b/ras-page-isolation.c @@ -252,9 +252,8 @@ static void row_offline_init(void) } } - if (!matched) { + if (!matched) log(TERM, LOG_INFO, "Improper %s, set to default off\n", env); - } if (row_offline_action > OFFLINE_ACCOUNT && access(kernel_offline[row_offline_action], W_OK)) { log(TERM, LOG_INFO, "Kernel does not support row offline interface\n"); @@ -489,11 +488,11 @@ bool row_record_is_same_row(struct row_record *rr1, struct row_record *rr2) int field_num = 0; - if (rr1->type == GHES) { + if (rr1->type == GHES) field_num = APEI_FIELD_NUM_CONST; - } else { + else field_num = DSM_FIELD_NUM_CONST; - } + for (int idx = 0; idx < field_num; idx++) { if (rr1->location_fields[idx] != rr2->location_fields[idx]) return false; @@ -506,9 +505,8 @@ void row_record_copy(struct row_record *dst, struct row_record *src) if (!dst || !src) return; - for (int i = 0; i < ROW_LOCATION_FIELDS_NUM; i++) { + for (int i = 0; i < ROW_LOCATION_FIELDS_NUM; i++) dst->location_fields[i] = src->location_fields[i]; - } } static int parse_value(const char *str, const char *anchor_str, int value_base, int *value)