Commit e2936b2a authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by David Woodhouse

mtd: do not use mtd->lock_user_prot_reg directly

Instead, check the -EOPNOTSUPP return code of 'mtd_lock_user_prot_reg()'.
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 27c151a5
...@@ -949,8 +949,6 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) ...@@ -949,8 +949,6 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
return -EINVAL; return -EINVAL;
if (copy_from_user(&oinfo, argp, sizeof(oinfo))) if (copy_from_user(&oinfo, argp, sizeof(oinfo)))
return -EFAULT; return -EFAULT;
if (!mtd->lock_user_prot_reg)
return -EOPNOTSUPP;
ret = mtd_lock_user_prot_reg(mtd, oinfo.start, oinfo.length); ret = mtd_lock_user_prot_reg(mtd, oinfo.start, oinfo.length);
break; break;
} }
......
...@@ -389,6 +389,8 @@ static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, ...@@ -389,6 +389,8 @@ static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to,
static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from,
size_t len) size_t len)
{ {
if (!mtd->lock_user_prot_reg)
return -EOPNOTSUPP;
return mtd->lock_user_prot_reg(mtd, from, len); return mtd->lock_user_prot_reg(mtd, from, len);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment