]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
rasdaemon: Fix the issue of command option -r for hip08
authorXiaofei Tan <tanxiaofei@huawei.com>
Wed, 20 Oct 2021 06:33:38 +0000 (14:33 +0800)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 1 Apr 2022 09:07:19 +0000 (11:07 +0200)
It will record event even the option -r is not provided for hip08.
It is not right, and fix it.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
non-standard-hisi_hip08.c
non-standard-hisilicon.c

index ebf03e197d3a59f819f83fad0627dd73664e7118..90921834397fe8bedb8a6494c6e27b4ed6fd5686 100644 (file)
@@ -670,7 +670,7 @@ static int decode_hip08_oem_type1_error(struct ras_events *ras,
        }
 
 #ifdef HAVE_SQLITE3
-       if (!ev_decoder->stmt_dec_record) {
+       if (ras->record_events && !ev_decoder->stmt_dec_record) {
                if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
                                            &hip08_oem_type1_event_tab)
                        != SQLITE_OK) {
@@ -842,7 +842,7 @@ static int decode_hip08_oem_type2_error(struct ras_events *ras,
        }
 
 #ifdef HAVE_SQLITE3
-       if (!ev_decoder->stmt_dec_record) {
+       if (ras->record_events && !ev_decoder->stmt_dec_record) {
                if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
                        &hip08_oem_type2_event_tab) != SQLITE_OK) {
                        trace_seq_printf(s,
@@ -992,7 +992,7 @@ static int decode_hip08_pcie_local_error(struct ras_events *ras,
        }
 
 #ifdef HAVE_SQLITE3
-       if (!ev_decoder->stmt_dec_record) {
+       if (ras->record_events && !ev_decoder->stmt_dec_record) {
                if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
                                &hip08_pcie_local_event_tab) != SQLITE_OK) {
                        trace_seq_printf(s,
index a6f5e788444ae68440f7c5c00ff975f560691083..3fccff66e7a3dc39df942cd3804358abf7e3c754 100644 (file)
@@ -77,6 +77,9 @@ void record_vendor_data(struct ras_ns_ev_decoder *ev_decoder,
                               enum hisi_oem_data_type data_type,
                               int id, int64_t data, const char *text)
 {
+       if (ev_decoder->stmt_dec_record == NULL)
+               return;
+
        switch (data_type) {
        case HISI_OEM_DATA_TYPE_INT:
                sqlite3_bind_int(ev_decoder->stmt_dec_record, id, data);
@@ -94,6 +97,9 @@ int step_vendor_data_tab(struct ras_ns_ev_decoder *ev_decoder, const char *name)
 {
        int rc;
 
+       if (ev_decoder->stmt_dec_record == NULL)
+               return 0;
+
        rc = sqlite3_step(ev_decoder->stmt_dec_record);
        if (rc != SQLITE_OK && rc != SQLITE_DONE)
                log(TERM, LOG_ERR,