Skip to content

Commit 281f7a6

Browse files
mwallemiquelraynal
authored andcommitted
mtd: core: prepare mtd_otp_nvmem_add() to handle -EPROBE_DEFER
NVMEM soon will get the ability for nvmem layouts and these might not be ready when nvmem_register() is called and thus it might return -EPROBE_DEFER. Don't print the error message in this case. Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20230308082021.870459-4-michael@walle.cc
1 parent e0489f6 commit 281f7a6

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/mtd/mtdcore.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,8 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd)
953953
nvmem = mtd_otp_nvmem_register(mtd, "user-otp", size,
954954
mtd_nvmem_user_otp_reg_read);
955955
if (IS_ERR(nvmem)) {
956-
dev_err(dev, "Failed to register OTP NVMEM device\n");
957-
return PTR_ERR(nvmem);
956+
err = PTR_ERR(nvmem);
957+
goto err;
958958
}
959959
mtd->otp_user_nvmem = nvmem;
960960
}
@@ -971,7 +971,6 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd)
971971
nvmem = mtd_otp_nvmem_register(mtd, "factory-otp", size,
972972
mtd_nvmem_fact_otp_reg_read);
973973
if (IS_ERR(nvmem)) {
974-
dev_err(dev, "Failed to register OTP NVMEM device\n");
975974
err = PTR_ERR(nvmem);
976975
goto err;
977976
}
@@ -983,7 +982,7 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd)
983982

984983
err:
985984
nvmem_unregister(mtd->otp_user_nvmem);
986-
return err;
985+
return dev_err_probe(dev, err, "Failed to register OTP NVMEM device\n");
987986
}
988987

989988
/**

0 commit comments

Comments
 (0)