Skip to content

Commit

Permalink
mtd: do not use mtd->lock_user_prot_reg directly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Artem Bityutskiy authored and David Woodhouse committed Jan 9, 2012
1 parent 27c151a commit e2936b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/mtd/mtdchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,8 +949,6 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
return -EINVAL;
if (copy_from_user(&oinfo, argp, sizeof(oinfo)))
return -EFAULT;
if (!mtd->lock_user_prot_reg)
return -EOPNOTSUPP;
ret = mtd_lock_user_prot_reg(mtd, oinfo.start, oinfo.length);
break;
}
Expand Down
2 changes: 2 additions & 0 deletions include/linux/mtd/mtd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
size_t len)
{
if (!mtd->lock_user_prot_reg)
return -EOPNOTSUPP;
return mtd->lock_user_prot_reg(mtd, from, len);
}

Expand Down

0 comments on commit e2936b2

Please sign in to comment.