@@ -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]);
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(-)