* [PATCH] mtd: check the return value of devm_ioremap() in docg3_probe()
@ 2022-07-22 9:16 williamsukatube
2022-09-19 16:16 ` Miquel Raynal
0 siblings, 1 reply; 2+ messages in thread
From: williamsukatube @ 2022-07-22 9:16 UTC (permalink / raw)
To: robert.jarzmik, miquel.raynal, richard, vigneshr, linux-mtd,
linux-kernel
Cc: William Dean, Hacash Robot
From: William Dean <williamsukatube@gmail.com>
The function devm_ioremap() in docg3_probe() can fail, so
its return value should be checked.
Fixes: 82402aeb8c81e ("mtd: docg3: Use devm_*() functions")
Reported-by: Hacash Robot <hacashRobot@santino.com>
Signed-off-by: William Dean <williamsukatube@gmail.com>
---
drivers/mtd/devices/docg3.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 5b0ae5ddad74..27c08f22dec8 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -1974,9 +1974,14 @@ static int __init docg3_probe(struct platform_device *pdev)
dev_err(dev, "No I/O memory resource defined\n");
return ret;
}
- base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE);
ret = -ENOMEM;
+ base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE);
+ if (!base) {
+ dev_err(dev, "devm_ioremap dev failed\n");
+ return ret;
+ }
+
cascade = devm_kcalloc(dev, DOC_MAX_NBFLOORS, sizeof(*cascade),
GFP_KERNEL);
if (!cascade)
--
2.25.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mtd: check the return value of devm_ioremap() in docg3_probe()
2022-07-22 9:16 [PATCH] mtd: check the return value of devm_ioremap() in docg3_probe() williamsukatube
@ 2022-09-19 16:16 ` Miquel Raynal
0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2022-09-19 16:16 UTC (permalink / raw)
To: williamsukatube, robert.jarzmik, miquel.raynal, richard,
vigneshr, linux-mtd, linux-kernel
Cc: William Dean, Hacash Robot
On Fri, 2022-07-22 at 09:16:44 UTC, williamsukatube@163.com wrote:
> From: William Dean <williamsukatube@gmail.com>
>
> The function devm_ioremap() in docg3_probe() can fail, so
> its return value should be checked.
>
> Fixes: 82402aeb8c81e ("mtd: docg3: Use devm_*() functions")
> Reported-by: Hacash Robot <hacashRobot@santino.com>
> Signed-off-by: William Dean <williamsukatube@gmail.com>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-19 16:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-22 9:16 [PATCH] mtd: check the return value of devm_ioremap() in docg3_probe() williamsukatube
2022-09-19 16:16 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).