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>
This commit is contained in:
parent
dac2639f98
commit
87e858a97e
2 changed files with 7 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue