diff options
author | Jia-Ju Bai <baijiaju1990@gmail.com> | 2021-03-07 19:44:46 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-05-14 09:50:09 +0200 |
commit | 5133b4bdc98e0cb3c94152d4b208f260ca1e57b9 (patch) | |
tree | 5b5c1ec556885eacc1502d6da20227531626dbb0 | |
parent | c55310e30de265b2af6fcbe020bff7b929540fd0 (diff) | |
download | linux-stable-5133b4bdc98e0cb3c94152d4b208f260ca1e57b9.tar.gz linux-stable-5133b4bdc98e0cb3c94152d4b208f260ca1e57b9.tar.bz2 linux-stable-5133b4bdc98e0cb3c94152d4b208f260ca1e57b9.zip |
mtd: maps: fix error return code of physmap_flash_remove()
[ Upstream commit 620b90d30c08684dc6ebee07c72755d997f9d1f6 ]
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: 73566edf9b91 ("[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>
-rw-r--r-- | drivers/mtd/maps/physmap-core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c index 001ed5deb622..4f63b8430c71 100644 --- a/drivers/mtd/maps/physmap-core.c +++ b/drivers/mtd/maps/physmap-core.c @@ -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); |