From: Jia-Ju Bai <baijiaju1990@gmail.com> To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, chris.packham@alliedtelesis.co.nz, Sergey.Semin@baikalelectronics.ru Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Jia-Ju Bai <baijiaju1990@gmail.com> Subject: [PATCH] mtd: maps: fix error return code of physmap_flash_remove() Date: Sun, 7 Mar 2021 19:44:46 -0800 [thread overview] Message-ID: <20210308034446.3052-1-baijiaju1990@gmail.com> (raw) 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> --- drivers/mtd/maps/physmap-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Jia-Ju Bai <baijiaju1990@gmail.com> To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, chris.packham@alliedtelesis.co.nz, Sergey.Semin@baikalelectronics.ru Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Jia-Ju Bai <baijiaju1990@gmail.com> Subject: [PATCH] mtd: maps: fix error return code of physmap_flash_remove() Date: Sun, 7 Mar 2021 19:44:46 -0800 [thread overview] Message-ID: <20210308034446.3052-1-baijiaju1990@gmail.com> (raw) 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> --- drivers/mtd/maps/physmap-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
next reply other threads:[~2021-03-08 3:45 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-08 3:44 Jia-Ju Bai [this message] 2021-03-08 3:44 ` [PATCH] mtd: maps: fix error return code of physmap_flash_remove() Jia-Ju Bai 2021-03-11 11:39 ` Miquel Raynal 2021-03-11 11:39 ` Miquel Raynal
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210308034446.3052-1-baijiaju1990@gmail.com \ --to=baijiaju1990@gmail.com \ --cc=Sergey.Semin@baikalelectronics.ru \ --cc=chris.packham@alliedtelesis.co.nz \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mtd@lists.infradead.org \ --cc=miquel.raynal@bootlin.com \ --cc=richard@nod.at \ --cc=vigneshr@ti.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.