1 --- a/drivers/mtd/devices/m25p80.c
2 +++ b/drivers/mtd/devices/m25p80.c
3 @@ -310,11 +310,21 @@ static const struct spi_device_id m25p_i
5 MODULE_DEVICE_TABLE(spi, m25p_ids);
7 +static const struct of_device_id m25p_of_table[] = {
9 + * Generic compatibility for SPI NOR that can be identified by the
10 + * JEDEC READ ID opcode (0x9F). Use this, if possible.
12 + { .compatible = "jedec,spi-nor" },
15 +MODULE_DEVICE_TABLE(of, m25p_of_table);
17 static struct spi_driver m25p80_driver = {
21 + .of_match_table = m25p_of_table,
25 --- a/drivers/mtd/spi-nor/spi-nor.c
26 +++ b/drivers/mtd/spi-nor/spi-nor.c
27 @@ -934,8 +934,11 @@ int spi_nor_scan(struct spi_nor *nor, co
31 - id = spi_nor_match_id(name);
33 + id = spi_nor_match_id(name);
35 + id = nor->read_id(nor);
36 + if (IS_ERR_OR_NULL(id))
39 info = (void *)id->driver_data;