You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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:
committed by
David Woodhouse
parent
dac2639f98
commit
87e858a97e
@@ -919,17 +919,15 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
|
||||
struct otp_info *buf = kmalloc(4096, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
ret = -EOPNOTSUPP;
|
||||
switch (mfi->mode) {
|
||||
case MTD_FILE_MODE_OTP_FACTORY:
|
||||
if (mtd->get_fact_prot_info)
|
||||
ret = mtd_get_fact_prot_info(mtd, buf, 4096);
|
||||
ret = mtd_get_fact_prot_info(mtd, buf, 4096);
|
||||
break;
|
||||
case MTD_FILE_MODE_OTP_USER:
|
||||
if (mtd->get_user_prot_info)
|
||||
ret = mtd_get_user_prot_info(mtd, buf, 4096);
|
||||
ret = mtd_get_user_prot_info(mtd, buf, 4096);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (ret >= 0) {
|
||||
|
||||
Reference in New Issue
Block a user