diff --git a/drivers/mtd/spiflash/spi020_nand.c b/drivers/mtd/spiflash/spi020_nand.c index 3dba1ce699..8ae3c8f081 100644 --- a/drivers/mtd/spiflash/spi020_nand.c +++ b/drivers/mtd/spiflash/spi020_nand.c @@ -673,7 +673,7 @@ static int drv_nand_read_id(struct drv_nand_dev_info *info, uint32_t *id) pr_debug("id = 0x%02x 0x%02x 0x%02x 0x%02x\n", card_id[0], card_id[1], card_id[2], card_id[3]); - for (i = 0; i < sizeof(spinand_flash_ids); i++) { + for (i = 0; i < ARRAY_SIZE(spinand_flash_ids); i++) { if ((card_id[0] == spinand_flash_ids[i].mfr_id) && \ (card_id[1] == spinand_flash_ids[i].dev_id)) { id_count = spinand_flash_ids[i].id_len; diff --git a/drivers/mtd/spiflash/spinand.c b/drivers/mtd/spiflash/spinand.c index 01e1a8f73c..06e679f907 100644 --- a/drivers/mtd/spiflash/spinand.c +++ b/drivers/mtd/spiflash/spinand.c @@ -839,7 +839,7 @@ static int drv_nand_read_id(struct drv_nand_dev_info *info, uint32_t *id) pr_debug("id = 0x%02x 0x%02x 0x%02x 0x%02x\n", card_id[0], card_id[1], card_id[2], card_id[3]); - for (i = 0; i < sizeof(spinand_flash_ids); i++) { + for (i = 0; i < ARRAY_SIZE(spinand_flash_ids); i++) { if ((card_id[0] == spinand_flash_ids[i].mfr_id) && \ (card_id[1] == spinand_flash_ids[i].dev_id)) { id_count = spinand_flash_ids[i].id_len;