diff mbox series

scsi: esas2r: Fix missing pci_disable_device() in esas2r_probe()

Message ID 20221125075115.27390-1-shangxiaojing@huawei.com
State New
Headers show
Series scsi: esas2r: Fix missing pci_disable_device() in esas2r_probe() | expand

Commit Message

shangxiaojing Nov. 25, 2022, 7:51 a.m. UTC
Add missing pci_disable_device() in fail path of scsi_host_alloc() and
scsi_add_host().

Fixes: 26780d9e12ed ("[SCSI] esas2r: ATTO Technology ExpressSAS 6G SAS/SATA RAID Adapter Driver")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
---
 drivers/scsi/esas2r/esas2r_main.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index 7a4eadad23d7..9e06a6e2da48 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -388,6 +388,7 @@  static int esas2r_probe(struct pci_dev *pcid,
 	host = scsi_host_alloc(&driver_template, host_alloc_size);
 	if (host == NULL) {
 		esas2r_log(ESAS2R_LOG_CRIT, "scsi_host_alloc() FAIL");
+		pci_disable_device(pcid);
 		return -ENODEV;
 	}
 
@@ -459,6 +460,7 @@  static int esas2r_probe(struct pci_dev *pcid,
 			       pcid);
 
 		pci_set_drvdata(pcid, NULL);
+		pci_disable_device(pcid);
 
 		return -ENODEV;
 	}