mtd/m25p80: fix test for end of loop

"plat_id" is always non-NULL here. There is a zero element on the end
of the m25p_ids[] array and if we hit the end of the loop then plat_id
points to that.

This would lead to a NULL pointer dereference later on in the function.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by Dan Carpenter and committed by David Woodhouse f78ec6b2 b06cd21e

+1 -1
+1 -1
drivers/mtd/devices/m25p80.c
··· 793 793 break; 794 794 } 795 795 796 - if (plat_id) 796 + if (i < ARRAY_SIZE(m25p_ids) - 1) 797 797 id = plat_id; 798 798 else 799 799 dev_warn(&spi->dev, "unrecognized id %s\n", data->type);