mtd: rawnand: jedec: Use intermediate variables to improve readability
authorMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 28 Apr 2020 09:43:02 +0000 (11:43 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 11 May 2020 07:51:41 +0000 (09:51 +0200)
Before reworking a little bit the JEDEC detection code, let's
clean the coding style of an if statement to improve readability.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://lore.kernel.org/linux-mtd/20200428094302.14624-10-miquel.raynal@bootlin.com
drivers/mtd/nand/raw/nand_jedec.c

index 0cd322a..15937e0 100644 (file)
@@ -30,6 +30,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);
 
@@ -56,8 +57,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;
        }