mtd: maps: fix error return code of physmap_flash_remove()
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")
Reported-by TOTE Robot <[email protected]>
Signed-off-by Jia-Ju Bai <[email protected]>
--- drivers/mtd/maps/physmap-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/maps/physmap-core.c +3 -1
@@ -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
Quoted 7 lines · Jia-Ju Bai
When
platform_get_drvdata()returns NULL to info, no error return code ofphysmap_flash_remove()is assigned.
To fix this bug, err is assigned with-EINVALin this caseFixes 73566edf9b91 ("[MTD] Convert physmap to platform driver")Reported-by TOTE Robot <[email protected]>Signed-off-by Jia-Ju Bai <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel