Skip to content

Commit bffabd1

Browse files
ambarusPratyush Yadav
authored andcommitted
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: 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
1 parent d0ddd88 commit bffabd1

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/mtd/spi-nor/core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2909,9 +2909,7 @@ static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor,
29092909
info = spi_nor_match_name(nor, name);
29102910
/* Try to auto-detect if chip name wasn't specified or not found */
29112911
if (!info)
2912-
info = spi_nor_read_id(nor);
2913-
if (IS_ERR_OR_NULL(info))
2914-
return ERR_PTR(-ENOENT);
2912+
return spi_nor_read_id(nor);
29152913

29162914
/*
29172915
* If caller has specified name of flash model that can normally be

0 commit comments

Comments
 (0)