mtd: maps: fix error return code of physmap_flash_remove()
[ Upstream commit620b90d30c] 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:73566edf9b("[MTD] Convert physmap to platform driver") Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210308034446.3052-1-baijiaju1990@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c55310e30d
commit
5133b4bdc9
1 changed files with 3 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue