Skip to contentSkip to conversation

PCI: fix pci_try_reset_function()

PATCH In review Dan Carpenter 2 participants 2 messages Jul 3, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: fix pci_try_reset_function()

There is a reversed if condition so the function doesn't work.

Fixes e94fae7aeef4 ("PCI: Protect pci_error_handlers->reset_notify() usage with device_lock()")
drivers/pci/pci.c +1 -1
index 5b49d662f996..3bf28bf04c3d 100644
@@ -4269,7 +4269,7 @@ int pci_try_reset_function(struct pci_dev *dev)
 	if (rc)
 		return rc;
 
-	if (pci_dev_trylock(dev))
+	if (!pci_dev_trylock(dev))
 		return -EAGAIN;
 
 	pci_dev_save_and_disable(dev);
#1 lore raw
Quoted 4 lines · Dan Carpenter

There is a reversed if condition so the function doesn't work.

Fixes e94fae7aeef4 ("PCI: Protect pci_error_handlers->reset_notify() usage with device_lock()")

Folded into pci/virtualization, thanks!

Quoted 13 lines
drivers/pci/pci.c +1 -1
index 5b49d662f996..3bf28bf04c3d 100644
@@ -4269,7 +4269,7 @@ int pci_try_reset_function(struct pci_dev *dev)
 	if (rc)
 		return rc;
 
-	if (pci_dev_trylock(dev))
+	if (!pci_dev_trylock(dev))
 		return -EAGAIN;
 
 	pci_dev_save_and_disable(dev);