EDAC/synopsys: Do not print an error with back-to-back snprintf() calls
commit dfc6014e3b60713f375d0601d7549eed224c4615 upstream.
handle_error() currently calls snprintf() a couple of times in
succession to output the message for a CE/UE, therefore overwriting each
part of the message which was formatted with the previous snprintf()
call. As a result, only the part of the message from the last snprintf()
call will be printed.
The simplest and most effective way to fix this problem is to combine
the whole string into one which to supply to a single snprintf() call.
[ bp: Massage. ]
Fixes: b500b4a029
("EDAC, synopsys: Add ECC support for ZynqMP DDR controller")
Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: James Morse <james.morse@arm.com>
Cc: Manish Narani <manish.narani@xilinx.com>
Link: https://lkml.kernel.org/r/1582792452-32575-1-git-send-email-sherry.sun@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
956ba569cc
commit
90335d6681
@ -479,20 +479,14 @@ static void handle_error(struct mem_ctl_info *mci, struct synps_ecc_status *p)
|
||||
pinf = &p->ceinfo;
|
||||
if (!priv->p_data->quirks) {
|
||||
snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
|
||||
"DDR ECC error type:%s Row %d Bank %d Col %d ",
|
||||
"CE", pinf->row, pinf->bank, pinf->col);
|
||||
snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
|
||||
"Bit Position: %d Data: 0x%08x\n",
|
||||
"DDR ECC error type:%s Row %d Bank %d Col %d Bit Position: %d Data: 0x%08x",
|
||||
"CE", pinf->row, pinf->bank, pinf->col,
|
||||
pinf->bitpos, pinf->data);
|
||||
} else {
|
||||
snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
|
||||
"DDR ECC error type:%s Row %d Bank %d Col %d ",
|
||||
"CE", pinf->row, pinf->bank, pinf->col);
|
||||
snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
|
||||
"BankGroup Number %d Block Number %d ",
|
||||
pinf->bankgrpnr, pinf->blknr);
|
||||
snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
|
||||
"Bit Position: %d Data: 0x%08x\n",
|
||||
"DDR ECC error type:%s Row %d Bank %d Col %d BankGroup Number %d Block Number %d Bit Position: %d Data: 0x%08x",
|
||||
"CE", pinf->row, pinf->bank, pinf->col,
|
||||
pinf->bankgrpnr, pinf->blknr,
|
||||
pinf->bitpos, pinf->data);
|
||||
}
|
||||
|
||||
@ -509,10 +503,8 @@ static void handle_error(struct mem_ctl_info *mci, struct synps_ecc_status *p)
|
||||
"UE", pinf->row, pinf->bank, pinf->col);
|
||||
} else {
|
||||
snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
|
||||
"DDR ECC error type :%s Row %d Bank %d Col %d ",
|
||||
"UE", pinf->row, pinf->bank, pinf->col);
|
||||
snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
|
||||
"BankGroup Number %d Block Number %d",
|
||||
"DDR ECC error type :%s Row %d Bank %d Col %d BankGroup Number %d Block Number %d",
|
||||
"UE", pinf->row, pinf->bank, pinf->col,
|
||||
pinf->bankgrpnr, pinf->blknr);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user