[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230607095124.38414-1-jiasheng@iscas.ac.cn>
Date: Wed, 7 Jun 2023 17:51:24 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: james.smart@...adcom.com, ram.vegesna@...adcom.com,
jejb@...ux.ibm.com, martin.petersen@...cle.com,
chenzhongjin@...wei.com, dwagner@...e.de, hare@...e.de
Cc: linux-scsi@...r.kernel.org, target-devel@...r.kernel.org,
linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH v2] scsi: efct: Add missing check for ioremap
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@...as.ac.cn>
---
Changelog:
v1 -> v2:
1. Add "rc = -EINVAL;" in the error handling.
---
drivers/scsi/elx/efct/efct_driver.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/elx/efct/efct_driver.c b/drivers/scsi/elx/efct/efct_driver.c
index 49fd2cfed70c..8cb6d42b7432 100644
--- a/drivers/scsi/elx/efct/efct_driver.c
+++ b/drivers/scsi/elx/efct/efct_driver.c
@@ -528,6 +528,10 @@ 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]) {
+ rc = -EINVAL;
+ goto ioremap_out;
+ }
r++;
}
@@ -580,7 +584,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]);
--
2.25.1
Powered by blists - more mailing lists