diff options
-rw-r--r-- | drivers/mtd/mtdchar.c | 4 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 4e8e5fbc1e13..25bbbc3aa665 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -310,10 +310,6 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c ret = -EROFS; break; case MTD_FILE_MODE_OTP_USER: - if (!mtd->write_user_prot_reg) { - ret = -EOPNOTSUPP; - break; - } ret = mtd_write_user_prot_reg(mtd, *ppos, len, &retlen, kbuf); break; diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index e488cf910914..7cd56d2b9419 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -381,6 +381,8 @@ static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, u_char *buf) { *retlen = 0; + if (!mtd->write_user_prot_reg) + return -EOPNOTSUPP; return mtd->write_user_prot_reg(mtd, to, len, retlen, buf); } |