]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: mtdconcat: Check _read, _write callbacks existence before assignment
authorZhihao Cheng <chengzhihao1@huawei.com>
Tue, 17 Aug 2021 11:48:57 +0000 (19:48 +0800)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 17 Aug 2021 16:43:33 +0000 (18:43 +0200)
commit89a9bbe4297f144adf74b842d6def996c1daafbc
treeb31c7e5844939208d3a0b1101bcc9233c8b0ee37
parent09a4d0b92765ebcba9d621fd700a3048e2c37371
mtd: mtdconcat: Check _read, _write callbacks existence before assignment

Since fb93e47270199 ("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

Fixes: fb93e47270199 ("mtd: Implement mtd_{read,write}() around ...")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210817114857.2784825-3-chengzhihao1@huawei.com
drivers/mtd/mtdconcat.c