mtd: mtdoops: do not use mtd->panic_write directly

Instead of checking if 'mtd->panic_write' is defined, call 'mtd_panic_write()'
and check the error code - '-EOPNOTSUPP' will be returned if the function is
not defined.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
Artem Bityutskiy
2011-12-28 17:27:18 +02:00
committed by David Woodhouse
parent 4991e7251e
commit 016c1291ce
2 changed files with 10 additions and 9 deletions

View File

@ -311,6 +311,8 @@ static inline int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf)
{
*retlen = 0;
if (!mtd->panic_write)
return -EOPNOTSUPP;
return mtd->panic_write(mtd, to, len, retlen, buf);
}