summaryrefslogtreecommitdiff
path: root/drivers/mtd/mtdcore.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtdcore.c')
-rw-r--r--drivers/mtd/mtdcore.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index abf4cb58a8ab..e00b12aa5ec9 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -975,12 +975,14 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd)
void *otp;
otp = kmalloc(size, GFP_KERNEL);
- if (!otp)
- return -ENOMEM;
+ if (!otp) {
+ err = -ENOMEM;
+ goto err;
+ }
err = mtd_nvmem_fact_otp_reg_read(mtd, 0, otp, size);
if (err < 0) {
kfree(otp);
- return err;
+ goto err;
}
add_device_randomness(otp, err);
kfree(otp);