mtd: do not use mtd->lock_user_prot_reg directly
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Mon Jan 9 13:59:16 EST 2012
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=e2936b2af5562c8c66060e2bc2ae2e209d0acd3d
Commit: e2936b2af5562c8c66060e2bc2ae2e209d0acd3d
Parent: 27c151a5e52efaa46d0938984f2ef591bdcb6d5b
Author: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
AuthorDate: Thu Dec 29 10:45:04 2011 +0200
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Jan 9 18:26:18 2012 +0000
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 at linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
drivers/mtd/mtdchar.c | 2 --
include/linux/mtd/mtd.h | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 25bbbc3..2020a16 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -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;
}
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 7cd56d2..a994129 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -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);
}
More information about the linux-mtd-cvs
mailing list