Skip to content

Commit 93d0380

Browse files
Johannes Thumshirngregkh
authored andcommitted
scsi: qla2xxx: don't disable a not previously enabled PCI device
commit ddff7ed45edce4a4c92949d3c61cd25d229c4a14 upstream. When pci_enable_device() or pci_enable_device_mem() fail in qla2x00_probe_one() we bail out but do a call to pci_disable_device(). This causes the dev_WARN_ON() in pci_disable_device() to trigger, as the device wasn't enabled previously. So instead of taking the 'probe_out' error path we can directly return *iff* one of the pci_enable_device() calls fails. Additionally rename the 'probe_out' goto label's name to the more descriptive 'disable_device'. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Fixes: e315cd2 ("[SCSI] qla2xxx: Code changes for qla data structure refactoring") Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Giridhar Malavali <giridhar.malavali@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f267b06 commit 93d0380

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,10 +2311,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
23112311

23122312
if (mem_only) {
23132313
if (pci_enable_device_mem(pdev))
2314-
goto probe_out;
2314+
return ret;
23152315
} else {
23162316
if (pci_enable_device(pdev))
2317-
goto probe_out;
2317+
return ret;
23182318
}
23192319

23202320
/* This may fail but that's ok */
@@ -2324,7 +2324,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
23242324
if (!ha) {
23252325
ql_log_pci(ql_log_fatal, pdev, 0x0009,
23262326
"Unable to allocate memory for ha.\n");
2327-
goto probe_out;
2327+
goto disable_device;
23282328
}
23292329
ql_dbg_pci(ql_dbg_init, pdev, 0x000a,
23302330
"Memory allocated for ha=%p.\n", ha);
@@ -2923,7 +2923,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
29232923
kfree(ha);
29242924
ha = NULL;
29252925

2926-
probe_out:
2926+
disable_device:
29272927
pci_disable_device(pdev);
29282928
return ret;
29292929
}

0 commit comments

Comments
 (0)