summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/spi-nor/core.c
diff options
context:
space:
mode:
authorTudor Ambarus <tudor.ambarus@microchip.com>2022-04-20 13:34:19 +0300
committerPratyush Yadav <p.yadav@ti.com>2022-04-27 14:57:35 +0530
commitbffabd1c727d663adf67ea762acc0e57164b3281 (patch)
tree995cbd4bbec279ebdcead882ac28fe918e8b7a9b /drivers/mtd/spi-nor/core.c
parentd0ddd88438d242de0de58b24eb9422e4ba183023 (diff)
downloadlinux-bffabd1c727d663adf67ea762acc0e57164b3281.tar.bz2
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
Diffstat (limited to 'drivers/mtd/spi-nor/core.c')
-rw-r--r--drivers/mtd/spi-nor/core.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index cebe952e0f00..386e81a3b12e 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -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