mtd: Avoid printing error messages on probe deferrals
authorMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 7 Mar 2023 19:25:06 +0000 (20:25 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 8 Mar 2023 14:02:24 +0000 (15:02 +0100)
There is no reason to complain about probe errors in case of deferrals.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Link: https://lore.kernel.org/linux-mtd/20230307192506.439532-1-miquel.raynal@bootlin.com
drivers/mtd/mtdcore.c

index 83a2256..83fb719 100644 (file)
@@ -536,12 +536,11 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
        mtd->nvmem = nvmem_register(&config);
        if (IS_ERR(mtd->nvmem)) {
                /* Just ignore if there is no NVMEM support in the kernel */
-               if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
+               if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP)
                        mtd->nvmem = NULL;
-               } else {
-                       dev_err(&mtd->dev, "Failed to register NVMEM device\n");
-                       return PTR_ERR(mtd->nvmem);
-               }
+               else
+                       return dev_err_probe(&mtd->dev, PTR_ERR(mtd->nvmem),
+                                            "Failed to register NVMEM device\n");
        }
 
        return 0;