mtd/m25p80: fix test for end of loop
[firefly-linux-kernel-4.4.55.git] / drivers / mtd / devices / m25p80.c
index 83c90867240f401a8975ae5aee50ecdc688fed0c..6f512b5c117b54ef0dddbe647cdfd53a52100541 100644 (file)
@@ -793,7 +793,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
                        break;
                }
 
-               if (plat_id)
+               if (i < ARRAY_SIZE(m25p_ids) - 1)
                        id = plat_id;
                else
                        dev_warn(&spi->dev, "unrecognized id %s\n", data->type);