summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/spi-nor-tiny.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-19 19:15:32 +0300
committerTom Rini <trini@konsulko.com>2020-08-04 05:19:54 +0300
commite567ec849a9aba4cd683ea23bd57c878b59714c4 (patch)
treeb60237cd3ceb1dc7bc9af89d2e3329e45d364bf7 /drivers/mtd/spi/spi-nor-tiny.c
parentf38a29997d1cdb71a85fc9dcdbee86d952b45482 (diff)
downloadu-boot-e567ec849a9aba4cd683ea23bd57c878b59714c4.tar.xz
mtd: spi-nor: Tidy up error handling / debug code
The -ENODEV error value in spi_nor_read_id() is incorrect since there clearly is a device - it just cannot be supported. Use -ENOMEDIUM instead which has the virtue of being less common. Fix the return value in spi_nor_scan(). Also there are a few printf() statements which should be debug() since they bloat the code with unused strings at present. Fix those while here. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/mtd/spi/spi-nor-tiny.c')
-rw-r--r--drivers/mtd/spi/spi-nor-tiny.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/spi/spi-nor-tiny.c b/drivers/mtd/spi/spi-nor-tiny.c
index 9f676c649d..fa26ea33c8 100644
--- a/drivers/mtd/spi/spi-nor-tiny.c
+++ b/drivers/mtd/spi/spi-nor-tiny.c
@@ -377,7 +377,7 @@ static const struct flash_info *spi_nor_read_id(struct spi_nor *nor)
}
dev_dbg(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n",
id[0], id[1], id[2]);
- return ERR_PTR(-ENODEV);
+ return ERR_PTR(-EMEDIUMTYPE);
}
static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
@@ -733,7 +733,7 @@ int spi_nor_scan(struct spi_nor *nor)
info = spi_nor_read_id(nor);
if (IS_ERR_OR_NULL(info))
- return -ENOENT;
+ return PTR_ERR(info);
/* Parse the Serial Flash Discoverable Parameters table. */
ret = spi_nor_init_params(nor, info, &params);
if (ret)