diff mbox

PCI: fix pci_try_reset_function()

Message ID 20170701135323.x5vaj4e2wcs2mcro@mwanda (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Dan Carpenter July 3, 2017, 11:09 a.m. UTC
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()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Bjorn Helgaas July 3, 2017, 1 p.m. UTC | #1
On Mon, Jul 03, 2017 at 02:09:19PM +0300, Dan Carpenter wrote:
> 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()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Folded into pci/virtualization, thanks!

> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 5b49d662f996..3bf28bf04c3d 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -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);
diff mbox

Patch

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 5b49d662f996..3bf28bf04c3d 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -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);