Skip to content

Commit

Permalink
scsi: 3w-9xxx: Avoid disabling device if failing to enable it
Browse files Browse the repository at this point in the history
[ Upstream commit 7eff437 ]

The original code will "goto out_disable_device" and call
pci_disable_device() if pci_enable_device() fails. The kernel will generate
a warning message like "3w-9xxx 0000:00:05.0: disabling already-disabled
device".

We shouldn't disable a device that failed to be enabled. A simple return is
fine.

Link: https://lore.kernel.org/r/20220829110115.38789-1-fantasquex@gmail.com
Reported-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Letu Ren <fantasquex@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
FantasqueX authored and gregkh committed Oct 21, 2022
1 parent a065657 commit a51d20e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/3w-9xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2006,7 +2006,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
retval = pci_enable_device(pdev);
if (retval) {
TW_PRINTK(host, TW_DRIVER, 0x34, "Failed to enable pci device");
goto out_disable_device;
return -ENODEV;
}

pci_set_master(pdev);
Expand Down

0 comments on commit a51d20e

Please sign in to comment.