提交 f430d570 编写于 作者: B Borislav Petkov 提交者: Borislav Petkov

EDAC: Handle empty msg strings when reporting errors

A reported error could look like this

[  226.178315] EDAC MC0: 1 CE  on mc#0csrow#0channel#0 (csrow:0 channel:0 page:0x427c0d offset:0xde0 grain:0 syndrome:0x1c6)

with two spaces back-to-back due to the msg argument of
edac_mc_handle_error being passed on empty by the specific drivers.
Handle that.
Signed-off-by: NBorislav Petkov <borislav.petkov@amd.com>
上级 4da1b7bf
...@@ -966,20 +966,22 @@ static void edac_ce_error(struct mem_ctl_info *mci, ...@@ -966,20 +966,22 @@ static void edac_ce_error(struct mem_ctl_info *mci,
long grain) long grain)
{ {
unsigned long remapped_page; unsigned long remapped_page;
char *msg_aux = "";
if (*msg)
msg_aux = " ";
if (edac_mc_get_log_ce()) { if (edac_mc_get_log_ce()) {
if (other_detail && *other_detail) if (other_detail && *other_detail)
edac_mc_printk(mci, KERN_WARNING, edac_mc_printk(mci, KERN_WARNING,
"%d CE %s on %s (%s %s - %s)\n", "%d CE %s%son %s (%s %s - %s)\n",
error_count, error_count, msg, msg_aux, label,
msg, label, location, location, detail, other_detail);
detail, other_detail);
else else
edac_mc_printk(mci, KERN_WARNING, edac_mc_printk(mci, KERN_WARNING,
"%d CE %s on %s (%s %s)\n", "%d CE %s%son %s (%s %s)\n",
error_count, error_count, msg, msg_aux, label,
msg, label, location, location, detail);
detail);
} }
edac_inc_ce_error(mci, enable_per_layer_report, pos, error_count); edac_inc_ce_error(mci, enable_per_layer_report, pos, error_count);
...@@ -1014,27 +1016,31 @@ static void edac_ue_error(struct mem_ctl_info *mci, ...@@ -1014,27 +1016,31 @@ static void edac_ue_error(struct mem_ctl_info *mci,
const char *other_detail, const char *other_detail,
const bool enable_per_layer_report) const bool enable_per_layer_report)
{ {
char *msg_aux = "";
if (*msg)
msg_aux = " ";
if (edac_mc_get_log_ue()) { if (edac_mc_get_log_ue()) {
if (other_detail && *other_detail) if (other_detail && *other_detail)
edac_mc_printk(mci, KERN_WARNING, edac_mc_printk(mci, KERN_WARNING,
"%d UE %s on %s (%s %s - %s)\n", "%d UE %s%son %s (%s %s - %s)\n",
error_count, error_count, msg, msg_aux, label,
msg, label, location, detail, location, detail, other_detail);
other_detail);
else else
edac_mc_printk(mci, KERN_WARNING, edac_mc_printk(mci, KERN_WARNING,
"%d UE %s on %s (%s %s)\n", "%d UE %s%son %s (%s %s)\n",
error_count, error_count, msg, msg_aux, label,
msg, label, location, detail); location, detail);
} }
if (edac_mc_get_panic_on_ue()) { if (edac_mc_get_panic_on_ue()) {
if (other_detail && *other_detail) if (other_detail && *other_detail)
panic("UE %s on %s (%s%s - %s)\n", panic("UE %s%son %s (%s%s - %s)\n",
msg, label, location, detail, other_detail); msg, msg_aux, label, location, detail, other_detail);
else else
panic("UE %s on %s (%s%s)\n", panic("UE %s%son %s (%s%s)\n",
msg, label, location, detail); msg, msg_aux, label, location, detail);
} }
edac_inc_ue_error(mci, enable_per_layer_report, pos, error_count); edac_inc_ue_error(mci, enable_per_layer_report, pos, error_count);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册