]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
rasdaemon: don't use braces for single statement blocks
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 18 Nov 2024 15:13:50 +0000 (16:13 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 18 Nov 2024 15:15:25 +0000 (16:15 +0100)
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 <mchehab+huawei@kernel.org>
ras-mc-handler.c
ras-page-isolation.c

index 1346e0ff9bff927da872f5a6371bfeb2f2e52146..d8e5d0d4f701f7059508345299d827ef4cfaba1a 100644 (file)
@@ -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
index eb1f3a9509be2b0c70f20ffaa106b239227a89e3..dc58710bdb2d749224e50fd94ad2b6492e70d9ea 100644 (file)
@@ -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)