From patchwork Sat Mar 25 09:18:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 743452 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vqvqL0bCZz9s3s for ; Sat, 25 Mar 2017 20:18:54 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vqvqK3n6GzDqZr for ; Sat, 25 Mar 2017 20:18:53 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vqvqB3DfGzDq7Z for ; Sat, 25 Mar 2017 20:18:46 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3vqvqB1yqLz9s3s; Sat, 25 Mar 2017 20:18:46 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id 793D8EEEE84; Sat, 25 Mar 2017 20:18:47 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Sat, 25 Mar 2017 20:18:43 +1100 Message-Id: <20170325091843.20418-1-mikey@neuling.org> X-Mailer: git-send-email 2.9.3 Subject: [Skiboot] [PATCH] libflash: Fix pflash -i X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, Michael Neuling , cyrilbur@gmail.com, Cyril Bur MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" pflash -i is currently broken due to this commit commit 602dee4505cd0ceb5b69f056ec403f982b585791 Author: Cyril Bur 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 Acked-by: Cyril Bur --- 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)