Commit 620b90d3 authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Miquel Raynal

mtd: maps: fix error return code of physmap_flash_remove()

When platform_get_drvdata() returns NULL to info, no error return code
of physmap_flash_remove() is assigned.
To fix this bug, err is assigned with -EINVAL in this case

Fixes: 73566edf ("[MTD] Convert physmap to platform driver")
Reported-by: default avatarTOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210308034446.3052-1-baijiaju1990@gmail.com
parent b87b6d2d
......@@ -69,8 +69,10 @@ static int physmap_flash_remove(struct platform_device *dev)
int i, err = 0;
info = platform_get_drvdata(dev);
if (!info)
if (!info) {
err = -EINVAL;
goto out;
}
if (info->cmtd) {
err = mtd_device_unregister(info->cmtd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment