Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Artem Bityutskiy and committed by
David Woodhouse
e2936b2a 27c151a5

+2 -2
-2
drivers/mtd/mtdchar.c
··· 949 949 return -EINVAL; 950 950 if (copy_from_user(&oinfo, argp, sizeof(oinfo))) 951 951 return -EFAULT; 952 - if (!mtd->lock_user_prot_reg) 953 - return -EOPNOTSUPP; 954 952 ret = mtd_lock_user_prot_reg(mtd, oinfo.start, oinfo.length); 955 953 break; 956 954 }
+2
include/linux/mtd/mtd.h
··· 389 389 static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, 390 390 size_t len) 391 391 { 392 + if (!mtd->lock_user_prot_reg) 393 + return -EOPNOTSUPP; 392 394 return mtd->lock_user_prot_reg(mtd, from, len); 393 395 } 394 396