[Skiboot] [PATCH] libflash: Fix pflash -i

Michael Neuling mikey at neuling.org
Sat Mar 25 20:18:43 AEDT 2017


pflash -i is currently broken due to this commit

  commit 602dee4505cd0ceb5b69f056ec403f982b585791
  Author: Cyril Bur <cyril.bur at au1.ibm.com>
  libflash/libffs: Rework libffs

It's output doesn't correctly detect the last partition and continues
printing forever.

This fixes it by returning null when we don't find a partition in
ffs_get_part().

Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 libflash/libffs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libflash/libffs.c b/libflash/libffs.c
index 9ce7224824..dca40188ed 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -187,9 +187,10 @@ static struct ffs_entry *ffs_get_part(struct ffs_handle *ffs, uint32_t index)
 
 	list_for_each(&ffs->hdr.entries, ent, list)
 		if (i++ == index)
-			break;
+			return ent;
 
-	return ent;
+	/* Didn't find partition */
+	return NULL;
 }
 
 bool has_ecc(struct ffs_entry *ent)
-- 
2.9.3



More information about the Skiboot mailing list