9ddda420ac3bbfa271db88c62ebb61083dfa1b43
[openwrt/staging/blocktrron.git] /
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
5 -EPROBE_DEFER
6
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.
10
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
14 ---
15 drivers/mtd/mtdcore.c | 7 +++----
16 1 file changed, 3 insertions(+), 4 deletions(-)
17
18 --- a/drivers/mtd/mtdcore.c
19 +++ b/drivers/mtd/mtdcore.c
20 @@ -953,8 +953,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);
23 if (IS_ERR(nvmem)) {
24 - dev_err(dev, "Failed to register OTP NVMEM device\n");
25 - return PTR_ERR(nvmem);
26 + err = PTR_ERR(nvmem);
27 + goto err;
28 }
29 mtd->otp_user_nvmem = nvmem;
30 }
31 @@ -971,7 +971,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);
34 if (IS_ERR(nvmem)) {
35 - dev_err(dev, "Failed to register OTP NVMEM device\n");
36 err = PTR_ERR(nvmem);
37 goto err;
38 }
39 @@ -983,7 +982,7 @@ static int mtd_otp_nvmem_add(struct mtd_
40
41 err:
42 nvmem_unregister(mtd->otp_user_nvmem);
43 - return err;
44 + return dev_err_probe(dev, err, "Failed to register OTP NVMEM device\n");
45 }
46
47 /**