linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: sun3x_esp: check the return value of ioremap() in esp_sun3x_probe()
@ 2022-08-02  7:36 studentxswpy
  0 siblings, 0 replies; only message in thread
From: studentxswpy @ 2022-08-02  7:36 UTC (permalink / raw)
  To: jejb, martin.petersen, linux-scsi, linux-kernel; +Cc: Xie Shaowen, Hacash Robot

From: Xie Shaowen <studentxswpy@163.com>

The function ioremap() in esp_sun3x_probe() can fail, so
its return value should be checked.

Fixes: 4bdc0d676a643 ("remove ioremap_nocache and devm_ioremap_nocache")
Reported-by: Hacash Robot <hacashRobot@santino.com>
Signed-off-by: Xie Shaowen <studentxswpy@163.com>
---
 drivers/scsi/sun3x_esp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c
index d3489ac7ab28..cc670b50a357 100644
--- a/drivers/scsi/sun3x_esp.c
+++ b/drivers/scsi/sun3x_esp.c
@@ -199,6 +199,8 @@ static int esp_sun3x_probe(struct platform_device *dev)
 		goto fail_unmap_regs;
 
 	esp->dma_regs = ioremap(res->start, 0x10);
+	if (!esp->dma_regs)
+		goto fail_unmap_regs;
 
 	esp->command_block = dma_alloc_coherent(esp->dev, 16,
 						&esp->command_block_dma,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-02  7:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02  7:36 [PATCH] scsi: sun3x_esp: check the return value of ioremap() in esp_sun3x_probe() studentxswpy

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