xec);
if ((bank_type == SMCA_UMC || bank_type == SMCA_UMC_QUIRK) && xec == 0) {
- if ((m->family == 0x19) && (m->model >= 0x90 && m->model <= 0x9f)) {
+ if (m->family == 0x19 && (m->model >= 0x90 && m->model <= 0x9f)) {
/* MCA_IPID[InstanceIdHi] give the AMD Node Die ID */
mce_snprintf(e->mc_location, "memory_die_id=%d", mcatype_instancehi / 4);
} else {
"Bus Error '%s, %s, mem-tx: %s, level: %s'",
PP_MSG(ec), TO_MSG(ec),
R4_MSG(ec), LL_MSG(ec));
- return;
}
p += snprintf(p, end - p, " 0x%x\n", INSTANCE(err->instance));
//display socket number
- if ((TYPE(err->type) == 0) &&
- ((err->subtype == 0x01) || (err->subtype == 0x02))) {
+ if (!TYPE(err->type) && (err->subtype == 0x01 || err->subtype == 0x02)) {
core_num = INSTANCE(err->instance) * 2 + err->subtype - 1;
p += snprintf(p, end - p, " %s",
disp_payload1_err_reg_name[i++]);
break;
}
- if ((!module) || (mod_id >= tbl_size))
+ if (!module || mod_id >= tbl_size)
return "unknown";
return module[mod_id];
tbl_size = 0;
}
- if ((!sub_module) || (sub_id >= tbl_size))
+ if (!sub_module || sub_id >= tbl_size)
return "unknown";
return sub_module[sub_id];
for (i = 0; i < CXL_HEADERLOG_SIZE_U32; i++) {
if (trace_seq_printf(s, "%08x ", ev.header_log[i]) <= 0)
break;
- if ((i > 0) && ((i % 20) == 0))
+ if (i > 0 && ((i % 20) == 0))
if (trace_seq_printf(s, "\n") <= 0)
break;
/* Convert header log data to the big-endian format because
if (trace_seq_printf(s, "\ndata:\n %08x: ", i) <= 0)
return -1;
for (i = 0; i < CXL_EVENT_RECORD_DATA_LENGTH; i += 4) {
- if ((i > 0) && ((i % 16) == 0))
+ if (i > 0 && ((i % 16) == 0))
if (trace_seq_printf(s, "\n %08x: ", i) <= 0)
break;
if (trace_seq_printf(s, "%02x%02x%02x%02x ",
return rc;
rc = open(fname, flags);
- if (rc)
+ if (rc < 0) {
+ rc = -errno;
+
return -errno;
+ }
- return 0;
+ return rc;
}
static int get_tracing_dir(struct ras_events *ras)
fd = open_trace(ras, fname, O_RDONLY);
if (fd < 0) {
- log(TERM, LOG_ERR,
- "Can't get %s:%s traces. Perhaps this feature is not supported on your system.\n",
- group, event);
- return -errno;
+ if (fd == -ENOENT) {
+ log(TERM, LOG_ERR,
+ "Feature %s:%s not supported on your system.\n",
+ group, event);
+ return EVENT_DISABLED;
+ }
+
+ log(TERM, LOG_ERR, "Can't get %s:%s traces: %s\n",
+ group, event, strerror(-fd));
+
+ return fd;
}
page = malloc(page_size);
if (!page) {
+ rc = -errno;
log(TERM, LOG_ERR, "Can't allocate page to read %s:%s format\n",
group, event);
- rc = -errno;
close(fd);
return rc;
}
}
rc = select_tracing_timestamp(ras);
- if (rc < 0) {
- log(TERM, LOG_ERR, "Can't select a timestamp for tracing\n");
- goto err;
- }
+ if (rc < 0)
+ log(TERM, LOG_ERR, "Can't select a timestamp for tracing. Using default\n");
pevent = tep_alloc();
if (!pevent) {
ras_aer_event_handler, NULL, AER_EVENT);
if (!rc)
num_events++;
- else if (rc != EVENT_DISABLED)
+ else if (rc != EVENT_DISABLED && rc != ENOENT)
log(ALL, LOG_ERR, "Can't get traces from %s:%s\n",
"ras", "aer_event");
#endif
if (!num_events) {
log(ALL, LOG_INFO,
- "Failed to trace all supported RAS events. Aborting.\n");
+ "Failed to trace any supported RAS events. Aborting.\n");
rc = -EINVAL;
goto err;
}
ras->mce_priv = calloc(1, sizeof(struct mce_priv));
if (!ras->mce_priv) {
log(ALL, LOG_INFO, "Can't allocate memory MCE data\n");
- return ENOMEM;
+ return -ENOMEM;
}
mce = ras->mce_priv;