Skip to content

Commit e2936b2

Browse files
dedekindDavid Woodhouse
authored andcommitted
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: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent 27c151a commit e2936b2

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/mtd/mtdchar.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,6 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
949949
return -EINVAL;
950950
if (copy_from_user(&oinfo, argp, sizeof(oinfo)))
951951
return -EFAULT;
952-
if (!mtd->lock_user_prot_reg)
953-
return -EOPNOTSUPP;
954952
ret = mtd_lock_user_prot_reg(mtd, oinfo.start, oinfo.length);
955953
break;
956954
}

‎include/linux/mtd/mtd.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to,
389389
static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from,
390390
size_t len)
391391
{
392+
if (!mtd->lock_user_prot_reg)
393+
return -EOPNOTSUPP;
392394
return mtd->lock_user_prot_reg(mtd, from, len);
393395
}
394396

0 commit comments

Comments
 (0)