[PATCH] mtd: Avoid printing error messages on probe deferrals

Miquel Raynal miquel.raynal at bootlin.com
Wed Mar 1 07:24:40 PST 2023


There is no reason to complain about probe errors in case of deferrals.

Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
---
 drivers/mtd/mtdcore.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 0feacb9fbdac..d163c690750a 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -518,6 +518,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
 {
 	struct device_node *node = mtd_get_of_node(mtd);
 	struct nvmem_config config = {};
+	int ret;
 
 	config.id = -1;
 	config.dev = &mtd->dev;
@@ -535,12 +536,15 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
 
 	mtd->nvmem = nvmem_register(&config);
 	if (IS_ERR(mtd->nvmem)) {
+		ret = PTR_ERR(mtd->nvmem);
 		/* Just ignore if there is no NVMEM support in the kernel */
-		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
+		if (ret == -EOPNOTSUPP) {
 			mtd->nvmem = NULL;
 		} else {
-			dev_err(&mtd->dev, "Failed to register NVMEM device\n");
-			return PTR_ERR(mtd->nvmem);
+			if (ret != -EPROBE_DEFER)
+				dev_err(&mtd->dev,
+					"Failed to register NVMEM device (%d)\n", ret);
+			return ret;
 		}
 	}
 
-- 
2.34.1




More information about the linux-mtd mailing list