summaryrefslogtreecommitdiff
path: root/include/linux/mtd/mtd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mtd/mtd.h')
-rw-r--r--include/linux/mtd/mtd.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 305f12b940f4..6c91ba59c229 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -406,16 +406,22 @@ static inline void mtd_sync(struct mtd_info *mtd)
/* Chip-supported device locking */
static inline int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
{
+ if (!mtd->lock)
+ return -EOPNOTSUPP;
return mtd->lock(mtd, ofs, len);
}
static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
{
+ if (!mtd->unlock)
+ return -EOPNOTSUPP;
return mtd->unlock(mtd, ofs, len);
}
static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
{
+ if (!mtd->is_locked)
+ return -EOPNOTSUPP;
return mtd->is_locked(mtd, ofs, len);
}