Skip to contentSkip to conversation

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

PATCH Applied Jia-Ju Bai 2 participants 2 messages Mar 8, 2021 – Mar 11, 2021 Memory technology devices (MTD)

lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

PATCH 1/1 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 73566edf9b91 ("[MTD] Convert physmap to platform driver")
---
 drivers/mtd/maps/physmap-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/maps/physmap-core.c +3 -1
index 001ed5deb622..4f63b8430c71 100644
@@ -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);
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 7 lines · Jia-Ju Bai

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")

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel