Skip to content

Commit

Permalink
mtd: spi-nor: core: Use auto-detection only once
Browse files Browse the repository at this point in the history
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: Tudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Link: https://lore.kernel.org/r/20220420103427.47867-4-tudor.ambarus@microchip.com
  • Loading branch information
ambarus authored and Pratyush Yadav committed Apr 21, 2022
1 parent d643a70 commit 67d9137
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/mtd/spi-nor/core.c
Expand Up @@ -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);
/* Try to auto-detect if chip name wasn't specified or not found */
if (!info)
info = spi_nor_read_id(nor);
if (IS_ERR_OR_NULL(info))
return ERR_PTR(-ENOENT);
return spi_nor_read_id(nor);

/*
* If caller has specified name of flash model that can normally be
Expand Down

0 comments on commit 67d9137

Please sign in to comment.