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

Cyril Bur cyril.bur at au1.ibm.com
Mon Mar 27 13:57:52 AEDT 2017


On Sat, 2017-03-25 at 20:18 +1100, Michael Neuling wrote:
> 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().
> 

How we don't have tests for this escapes me, good find Mikey!

> Signed-off-by: Michael Neuling <mikey at neuling.org>

Acked-by: Cyril Bur <cyril.bur at au1.ibm.com>


> ---
>  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)



More information about the Skiboot mailing list