[PATCH] scsi: nsp_cs: Check of ioremap return value

From: Jiasheng Jiang
Date: Wed Dec 29 2021 - 21:12:03 EST


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@xxxxxxxxxxx>
---
drivers/scsi/pcmcia/nsp_cs.c | 3 +++
1 file changed, 3 insertions(+)

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! */
--
2.25.1