summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorArtem Bityutskiy2011-12-28 17:47:46 +0100
committerDavid Woodhouse2012-01-09 19:26:15 +0100
commit87e858a97e8a7010aedc01db7cd31cc7c02b0b6a (patch)
treec5ff8b86ef0ae7891224e620916c58241c3e1799 /include/linux
parentmtd: do not use mtd->read_oob directly (diff)
downloadkernel-qcow2-linux-87e858a97e8a7010aedc01db7cd31cc7c02b0b6a.tar.gz
kernel-qcow2-linux-87e858a97e8a7010aedc01db7cd31cc7c02b0b6a.tar.xz
kernel-qcow2-linux-87e858a97e8a7010aedc01db7cd31cc7c02b0b6a.zip
mtd: do not use mtd->get_*_prot_info directly
Instead, call 'mtd_get_*_prot_info()' and check for '-EOPNOTSUPP'. While on it, fix the return code from '-EOPNOTSUPP' to '-EINVAL' for the case when the mode parameter is invalid. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mtd/mtd.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 721a63ffeb96..7122efdc6d99 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -342,6 +342,8 @@ static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
static inline int mtd_get_fact_prot_info(struct mtd_info *mtd,
struct otp_info *buf, size_t len)
{
+ if (!mtd->get_fact_prot_info)
+ return -EOPNOTSUPP;
return mtd->get_fact_prot_info(mtd, buf, len);
}
@@ -357,6 +359,8 @@ static inline int mtd_get_user_prot_info(struct mtd_info *mtd,
struct otp_info *buf,
size_t len)
{
+ if (!mtd->get_user_prot_info)
+ return -EOPNOTSUPP;
return mtd->get_user_prot_info(mtd, buf, len);
}