EDAC/synopsys: Do not print an error with back-to-back snprintf() calls

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: b500b4a029d57 ("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

authored by Sherry Sun and committed by Borislav Petkov dfc6014e f8788d86

Changed files
+7 -15
drivers
+7 -15
drivers/edac/synopsys_edac.c
··· 479 479 pinf = &p->ceinfo; 480 480 if (!priv->p_data->quirks) { 481 481 snprintf(priv->message, SYNPS_EDAC_MSG_SIZE, 482 - "DDR ECC error type:%s Row %d Bank %d Col %d ", 483 - "CE", pinf->row, pinf->bank, pinf->col); 484 - snprintf(priv->message, SYNPS_EDAC_MSG_SIZE, 485 - "Bit Position: %d Data: 0x%08x\n", 482 + "DDR ECC error type:%s Row %d Bank %d Col %d Bit Position: %d Data: 0x%08x", 483 + "CE", pinf->row, pinf->bank, pinf->col, 486 484 pinf->bitpos, pinf->data); 487 485 } else { 488 486 snprintf(priv->message, SYNPS_EDAC_MSG_SIZE, 489 - "DDR ECC error type:%s Row %d Bank %d Col %d ", 490 - "CE", pinf->row, pinf->bank, pinf->col); 491 - snprintf(priv->message, SYNPS_EDAC_MSG_SIZE, 492 - "BankGroup Number %d Block Number %d ", 493 - pinf->bankgrpnr, pinf->blknr); 494 - snprintf(priv->message, SYNPS_EDAC_MSG_SIZE, 495 - "Bit Position: %d Data: 0x%08x\n", 487 + "DDR ECC error type:%s Row %d Bank %d Col %d BankGroup Number %d Block Number %d Bit Position: %d Data: 0x%08x", 488 + "CE", pinf->row, pinf->bank, pinf->col, 489 + pinf->bankgrpnr, pinf->blknr, 496 490 pinf->bitpos, pinf->data); 497 491 } 498 492 ··· 503 509 "UE", pinf->row, pinf->bank, pinf->col); 504 510 } else { 505 511 snprintf(priv->message, SYNPS_EDAC_MSG_SIZE, 506 - "DDR ECC error type :%s Row %d Bank %d Col %d ", 507 - "UE", pinf->row, pinf->bank, pinf->col); 508 - snprintf(priv->message, SYNPS_EDAC_MSG_SIZE, 509 - "BankGroup Number %d Block Number %d", 512 + "DDR ECC error type :%s Row %d Bank %d Col %d BankGroup Number %d Block Number %d", 513 + "UE", pinf->row, pinf->bank, pinf->col, 510 514 pinf->bankgrpnr, pinf->blknr); 511 515 } 512 516