Commit 33ac674f authored by Zhihao Cheng's avatar Zhihao Cheng Committed by Zheng Zengkai
Browse files

mtd: mtdconcat: Check _read,_write callbacks existence before assignment

hulk inclusion
category: bugfix
bugzilla: 175251 https://gitee.com/openeuler/kernel/issues/I4DDEL

-------------------------------------------------

Since 2431c4f5 ("mtd: Implement mtd_{read,write}() as wrappers
around mtd_{read,write}_oob()") don't allow _write|_read and
_write_oob|_read_oob existing at the same time, we should check the
existence of callbacks "_read and _write" from subdev's master device
(We can trust master device since it has been registered) before
assigning, otherwise following warning occurs while making
concatenated device:

  WARNING: CPU: 2 PID: 6728 at drivers/mtd/mtdcore.c:595
  add_mtd_device+0x7f/0x7b0

Link: https://lkml.org/lkml/2021/7/30/1148


Fixes: 2431c4f5 ("mtd: Implement mtd_{read,write}() around ...")
Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: default avatarJason Yan <yanaijie@huawei.com>
Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent cb1f32b8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment