diff mbox series

scsi: efct: Add missing check for ioremap

Message ID 20230607093730.18982-1-jiasheng@iscas.ac.cn
State New
Headers show
Series scsi: efct: Add missing check for ioremap | expand

Commit Message

Jiasheng Jiang June 7, 2023, 9:37 a.m. UTC
Add check for ioremap() and return the error if it fails in order to
guarantee the success of ioremap().

Fixes: 4df84e846624 ("scsi: elx: efct: Driver initialization routines")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/scsi/elx/efct/efct_driver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/scsi/elx/efct/efct_driver.c b/drivers/scsi/elx/efct/efct_driver.c
index 49fd2cfed70c..77c6252dcb3e 100644
--- a/drivers/scsi/elx/efct/efct_driver.c
+++ b/drivers/scsi/elx/efct/efct_driver.c
@@ -528,6 +528,8 @@  efct_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		if (pci_resource_flags(pdev, i) & IORESOURCE_MEM) {
 			efct->reg[r] = ioremap(pci_resource_start(pdev, i),
 					       pci_resource_len(pdev, i));
+			if (!efct->reg[r])
+				goto ioremap_out;
 			r++;
 		}
 
@@ -580,7 +582,7 @@  efct_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	efct_teardown_msix(efct);
 dma_mask_out:
 	pci_set_drvdata(pdev, NULL);
-
+ioremap_out:
 	for (i = 0; i < EFCT_PCI_MAX_REGS; i++) {
 		if (efct->reg[i])
 			iounmap(efct->reg[i]);