diff mbox series

scsi: nsp_cs: Check of ioremap return value

Message ID 20211230021137.1823352-1-jiasheng@iscas.ac.cn (mailing list archive)
State Accepted
Headers show
Series scsi: nsp_cs: Check of ioremap return value | expand

Commit Message

Jiasheng Jiang Dec. 30, 2021, 2:11 a.m. UTC
As the possible failure of the ioremap(), the 'data->MmioAddress' could
be NULL.
Therefore it should be better to check it in order to transfer the
error.

Fixes: 0e6f9d270840 ("pcmcia: use pcmcia_loop_config in scsi pcmcia drivers")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/scsi/pcmcia/nsp_cs.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Martin K. Petersen Jan. 19, 2022, 4:06 a.m. UTC | #1
On Thu, 30 Dec 2021 10:11:37 +0800, Jiasheng Jiang wrote:

> As the possible failure of the ioremap(), the 'data->MmioAddress' could
> be NULL.
> Therefore it should be better to check it in order to transfer the
> error.
> 
> 

Applied to 5.17/scsi-queue, thanks!

[1/1] scsi: nsp_cs: Check of ioremap return value
      https://git.kernel.org/mkp/scsi/c/2576e153cd98
diff mbox series

Patch

diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index ac89002646a3..bcd61439ca3f 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1560,6 +1560,9 @@  static int nsp_cs_config_check(struct pcmcia_device *p_dev, void *priv_data)
 		data->MmioAddress = (unsigned long)
 			ioremap(p_dev->resource[2]->start,
 					resource_size(p_dev->resource[2]));
+		if (!data->MmioAddress)
+			goto next_entry;
+
 		data->MmioLength  = resource_size(p_dev->resource[2]);
 	}
 	/* If we got this far, we're cool! */