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 --- non-standard-hisi_hip08.c | 6 +++--- non-standard-hisilicon.c | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/non-standard-hisi_hip08.c b/non-standard-hisi_hip08.c index ebf03e1..9092183 100644 --- a/non-standard-hisi_hip08.c +++ b/non-standard-hisi_hip08.c @@ -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, diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c index a6f5e78..3fccff6 100644 --- a/non-standard-hisilicon.c +++ b/non-standard-hisilicon.c @@ -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,