1 From 281f7a6c1a33fffcde32001bacbb4f672140fbf9 Mon Sep 17 00:00:00 2001
2 From: Michael Walle <michael@walle.cc>
3 Date: Wed, 8 Mar 2023 09:20:21 +0100
4 Subject: [PATCH] mtd: core: prepare mtd_otp_nvmem_add() to handle
7 NVMEM soon will get the ability for nvmem layouts and these might
8 not be ready when nvmem_register() is called and thus it might
9 return -EPROBE_DEFER. Don't print the error message in this case.
11 Signed-off-by: Michael Walle <michael@walle.cc>
12 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
13 Link: https://lore.kernel.org/linux-mtd/20230308082021.870459-4-michael@walle.cc
15 drivers/mtd/mtdcore.c | 7 +++----
16 1 file changed, 3 insertions(+), 4 deletions(-)
18 --- a/drivers/mtd/mtdcore.c
19 +++ b/drivers/mtd/mtdcore.c
20 @@ -962,8 +962,8 @@ static int mtd_otp_nvmem_add(struct mtd_
21 nvmem = mtd_otp_nvmem_register(mtd, "user-otp", size,
22 mtd_nvmem_user_otp_reg_read);
24 - dev_err(dev, "Failed to register OTP NVMEM device\n");
25 - return PTR_ERR(nvmem);
26 + err = PTR_ERR(nvmem);
29 mtd->otp_user_nvmem = nvmem;
31 @@ -980,7 +980,6 @@ static int mtd_otp_nvmem_add(struct mtd_
32 nvmem = mtd_otp_nvmem_register(mtd, "factory-otp", size,
33 mtd_nvmem_fact_otp_reg_read);
35 - dev_err(dev, "Failed to register OTP NVMEM device\n");
39 @@ -993,7 +992,7 @@ static int mtd_otp_nvmem_add(struct mtd_
41 if (mtd->otp_user_nvmem)
42 nvmem_unregister(mtd->otp_user_nvmem);
44 + return dev_err_probe(dev, err, "Failed to register OTP NVMEM device\n");