Skip to content

Commit a296a1b

Browse files
ndreyscomputersforpeace
authored andcommitted
mtd: dataflash: Get rid of loop counter in jedec_probe()
"For" loop in jedec_probe can be simplified to not need counter 'i'. Convert the code and get rid of the variable. Cc: [email protected] Cc: David Woodhouse <[email protected]> Cc: Brian Norris <[email protected]> Cc: Boris Brezillon <[email protected]> Cc: Marek Vasut <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Cyrille Pitchen <[email protected]> Cc: [email protected] Reviewed-by: Marek Vasut <[email protected]> Tested-by: Chris Healy <[email protected]> Signed-off-by: Andrey Smirnov <[email protected]> Signed-off-by: Brian Norris <[email protected]>
1 parent 02f6286 commit a296a1b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/mtd/devices/mtd_dataflash.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ static struct flash_info dataflash_data[] = {
736736

737737
static struct flash_info *jedec_probe(struct spi_device *spi)
738738
{
739-
int ret, i;
739+
int ret;
740740
u8 code = OP_READ_ID;
741741
u8 id[3];
742742
u32 jedec;
@@ -767,9 +767,9 @@ static struct flash_info *jedec_probe(struct spi_device *spi)
767767
jedec = jedec << 8;
768768
jedec |= id[2];
769769

770-
for (i = 0, info = dataflash_data;
771-
i < ARRAY_SIZE(dataflash_data);
772-
i++, info++) {
770+
for (info = dataflash_data;
771+
info < dataflash_data + ARRAY_SIZE(dataflash_data);
772+
info++) {
773773
if (info->jedec_id == jedec) {
774774
dev_dbg(&spi->dev, "OTP, sector protect%s\n",
775775
(info->flags & SUP_POW2PS) ?

0 commit comments

Comments
 (0)