mtd: rawnand: onfi: Use intermediate variables to improve readability
Before reworking a little bit the ONFI detection code, let's clean the coding style of the if statements 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-5-miquel.raynal@bootlin.com
This commit is contained in:
parent
1d5d08ee9b
commit
543e34f29d
@ -146,6 +146,7 @@ int nand_onfi_detect(struct nand_chip *chip)
|
||||
int onfi_version = 0;
|
||||
char id[4];
|
||||
int i, ret, val;
|
||||
u16 crc;
|
||||
|
||||
memorg = nanddev_get_memorg(&chip->base);
|
||||
|
||||
@ -172,8 +173,8 @@ int nand_onfi_detect(struct nand_chip *chip)
|
||||
goto free_onfi_param_page;
|
||||
}
|
||||
|
||||
if (onfi_crc16(ONFI_CRC_BASE, (u8 *)&p[i], 254) ==
|
||||
le16_to_cpu(p[i].crc)) {
|
||||
crc = onfi_crc16(ONFI_CRC_BASE, (u8 *)&p[i], 254);
|
||||
if (crc == le16_to_cpu(p[i].crc)) {
|
||||
if (i)
|
||||
memcpy(p, &p[i], sizeof(*p));
|
||||
break;
|
||||
@ -187,8 +188,8 @@ int nand_onfi_detect(struct nand_chip *chip)
|
||||
nand_bit_wise_majority(srcbufs, ARRAY_SIZE(srcbufs), p,
|
||||
sizeof(*p));
|
||||
|
||||
if (onfi_crc16(ONFI_CRC_BASE, (u8 *)p, 254) !=
|
||||
le16_to_cpu(p->crc)) {
|
||||
crc = onfi_crc16(ONFI_CRC_BASE, (u8 *)p, 254);
|
||||
if (crc != le16_to_cpu(p->crc)) {
|
||||
pr_err("ONFI parameter recovery failed, aborting\n");
|
||||
goto free_onfi_param_page;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user