[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211230021137.1823352-1-jiasheng@iscas.ac.cn>
Date: Thu, 30 Dec 2021 10:11:37 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: yokota@...lab.is.tsukuba.ac.jp, jejb@...ux.ibm.com,
martin.petersen@...cle.com
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] scsi: nsp_cs: Check of ioremap return value
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@...as.ac.cn>
---
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
Powered by blists - more mailing lists