[Skiboot] [PATCH] libflash: Fix broken continuations

Oliver O'Halloran oohall at gmail.com
Mon Jul 15 17:05:05 AEST 2019


Some of the libflash debug messages don't print a newlines at the end of
the line and assume that the next print will be contigious with the
last. This isn't true in skiboot since log messages are prefixed with a
timestamp. This results in funny looking output such as:

LIBFLASH: Verifying...
LIBFLASH:   reading page 0x01963000..0x01964000...[3.084846885,7]  same !
LIBFLASH:   reading page 0x01964000..0x01965000...[3.086164489,7]  same !

Fix this by moving the "same !" debug message to a new line with the
prefix "LIBFLASH:   ..." to indicate it's a continuation of the last
statement.

First reported in https://github.com/open-power/skiboot/issues/51

Reported-by: Joel Stanley <joel at jms.id.au>
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 libflash/libflash.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libflash/libflash.c b/libflash/libflash.c
index ad25b613357a..992d35cb3141 100644
--- a/libflash/libflash.c
+++ b/libflash/libflash.c
@@ -500,11 +500,11 @@ static int flash_smart_write(struct blocklevel_device *bl, uint64_t dst, const v
 		/* Figure out which erase page we are in and read it */
 		page = dst & ~c->min_erase_mask;
 		off = dst & c->min_erase_mask;
-		FL_DBG("LIBFLASH:   reading page 0x%08x..0x%08x...",
+		FL_DBG("LIBFLASH:   reading page 0x%08x..0x%08x...\n",
 		       page, page + er_size);
 		rc = flash_read(bl, page, c->smart_buf, er_size);
 		if (rc) {
-			FL_DBG(" error %d!\n", rc);
+			FL_DBG("LIBFLASH:    ...error %d!\n", rc);
 			return rc;
 		}
 
@@ -518,11 +518,11 @@ static int flash_smart_write(struct blocklevel_device *bl, uint64_t dst, const v
 		switch(sr) {
 		case sm_no_change:
 			/* Identical, skip it */
-			FL_DBG(" same !\n");
+			FL_DBG("LIBFLASH:    ...same !\n");
 			break;
 		case sm_need_write:
 			/* Just needs writing over */
-			FL_DBG(" need write !\n");
+			FL_DBG("LIBFLASH:    ...need write !\n");
 			rc = flash_write(bl, dst, src, chunk, true);
 			if (rc) {
 				FL_DBG("LIBFLASH: Write error %d !\n", rc);
@@ -530,7 +530,7 @@ static int flash_smart_write(struct blocklevel_device *bl, uint64_t dst, const v
 			}
 			break;
 		case sm_need_erase:
-			FL_DBG(" need erase !\n");
+			FL_DBG("LIBFLASH:    ...need erase !\n");
 			rc = flash_erase(bl, page, er_size);
 			if (rc) {
 				FL_DBG("LIBFLASH: erase error %d !\n", rc);
-- 
2.21.0



More information about the Skiboot mailing list