Re: [PATCH 7/8] mtd: rawnand: jedec: Use an intermediate variable to decomplefixy conditions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 21 Apr 2020 18:46:36 +0200
Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:

> Before reworking a little bit the JEDEC detection code, let's
> decomplefixy an if statement.

Same comment as earlier, it's not about complexity but readability.

Reviewed-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>

> 
> Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
> ---
>  drivers/mtd/nand/raw/nand_jedec.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/nand_jedec.c b/drivers/mtd/nand/raw/nand_jedec.c
> index 9b540e76f84f..4cc1ea512887 100644
> --- a/drivers/mtd/nand/raw/nand_jedec.c
> +++ b/drivers/mtd/nand/raw/nand_jedec.c
> @@ -28,6 +28,7 @@ int nand_jedec_detect(struct nand_chip *chip)
>  	int jedec_version = 0;
>  	char id[5];
>  	int i, val, ret;
> +	u16 crc;
>  
>  	memorg = nanddev_get_memorg(&chip->base);
>  
> @@ -54,8 +55,8 @@ int nand_jedec_detect(struct nand_chip *chip)
>  			goto free_jedec_param_page;
>  		}
>  
> -		if (onfi_crc16(ONFI_CRC_BASE, (uint8_t *)p, 510) ==
> -				le16_to_cpu(p->crc))
> +		crc = onfi_crc16(ONFI_CRC_BASE, (u8 *)p, 510);
> +		if (crc == le16_to_cpu(p->crc))
>  			break;
>  	}
>  


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux