Commit bffabd1c authored by Tudor Ambarus's avatar Tudor Ambarus Committed by Pratyush Yadav

mtd: spi-nor: core: Use auto-detection only once

In case spi_nor_match_name() returned NULL, the auto detection was
issued twice. There's no reason to try to detect the same chip twice,
do the auto detection only once.
Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
Reviewed-by: default avatarMichael Walle <michael@walle.cc>
Link: https://lore.kernel.org/r/20220420103427.47867-4-tudor.ambarus@microchip.com
parent d0ddd884
...@@ -2909,9 +2909,7 @@ static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor, ...@@ -2909,9 +2909,7 @@ static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor,
info = spi_nor_match_name(nor, name); info = spi_nor_match_name(nor, name);
/* Try to auto-detect if chip name wasn't specified or not found */ /* Try to auto-detect if chip name wasn't specified or not found */
if (!info) if (!info)
info = spi_nor_read_id(nor); return spi_nor_read_id(nor);
if (IS_ERR_OR_NULL(info))
return ERR_PTR(-ENOENT);
/* /*
* If caller has specified name of flash model that can normally be * If caller has specified name of flash model that can normally be
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment