projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c55310e
)
mtd: maps: fix error return code of physmap_flash_remove()
author
Jia-Ju Bai
<baijiaju1990@gmail.com>
Mon, 8 Mar 2021 03:44:46 +0000
(19:44 -0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Fri, 14 May 2021 07:50:09 +0000
(09:50 +0200)
[ 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>
drivers/mtd/maps/physmap-core.c
patch
|
blob
|
history
diff --git
a/drivers/mtd/maps/physmap-core.c
b/drivers/mtd/maps/physmap-core.c
index 001ed5deb622aacfa82b58c0ac7dcf03a3b1085c..4f63b8430c710c017a2e151a64e97e9275d358da 100644
(file)
--- 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);
int i, err = 0;
info = platform_get_drvdata(dev);
- if (!info)
+ if (!info) {
+ err = -EINVAL;
goto out;
goto out;
+ }
if (info->cmtd) {
err = mtd_device_unregister(info->cmtd);
if (info->cmtd) {
err = mtd_device_unregister(info->cmtd);