summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/nand_base.c
diff options
context:
space:
mode:
authorJean-Louis Thekekara <jeanlouis.thekekara@parrot.com>2017-06-29 20:08:30 +0300
committerBoris Brezillon <boris.brezillon@free-electrons.com>2017-08-23 17:49:13 +0300
commit5158bd5597e4c0939db3ecefbcbf492c425e611c (patch)
tree0a4c1e150f26e53033f8955a7e27ceacb547c011 /drivers/mtd/nand/nand_base.c
parentf84674b82af2c3ea68b9032d1244f364e46cc75d (diff)
downloadlinux-5158bd5597e4c0939db3ecefbcbf492c425e611c.tar.xz
mtd: nand: remove hard-coded NAND ids length
This commit removes hard-coded '8' used for looping into struct nand_chip.id.data array. NAND_MAX_ID_LEN has been introduced by Artem Bityutskiy in 53552d22bfe1f for defining ids length in nand_flash_ids[] list. This commit unifies ids length in nand base driver. Signed-off-by: Jean-Louis Thekekara <jeanlouis.thekekara@parrot.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Diffstat (limited to 'drivers/mtd/nand/nand_base.c')
-rw-r--r--drivers/mtd/nand/nand_base.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index abcb15fba484..ab2804379b0d 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3886,7 +3886,7 @@ static int nand_detect(struct nand_chip *chip, struct nand_flash_dev *type)
chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
/* Read entire ID string */
- for (i = 0; i < 8; i++)
+ for (i = 0; i < ARRAY_SIZE(chip->id.data); i++)
id_data[i] = chip->read_byte(mtd);
if (id_data[0] != maf_id || id_data[1] != dev_id) {
@@ -3895,7 +3895,7 @@ static int nand_detect(struct nand_chip *chip, struct nand_flash_dev *type)
return -ENODEV;
}
- chip->id.len = nand_id_len(id_data, 8);
+ chip->id.len = nand_id_len(id_data, ARRAY_SIZE(chip->id.data));
/* Try to identify manufacturer */
manufacturer = nand_get_manufacturer(maf_id);