[PATCH] PCI: rework error checking in the reset path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The return codes from various reset types are not consistent. The code is
assuming that all reset types will return -ENOTTY when things go wrong.
Instead of relying on negative error status, let's bail out if the
operation is successful instead.

Signed-off-by: Sinan Kaya <okaya@xxxxxxxxxxxxxx>
---
 drivers/pci/pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 6078dfc..a753e07 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4200,20 +4200,20 @@ int __pci_reset_function_locked(struct pci_dev *dev)
 	might_sleep();
 
 	rc = pci_dev_specific_reset(dev, 0);
-	if (rc != -ENOTTY)
+	if (!rc)
 		return rc;
 	if (pcie_has_flr(dev)) {
 		pcie_flr(dev);
 		return 0;
 	}
 	rc = pci_af_flr(dev, 0);
-	if (rc != -ENOTTY)
+	if (!rc)
 		return rc;
 	rc = pci_pm_reset(dev, 0);
-	if (rc != -ENOTTY)
+	if (!rc)
 		return rc;
 	rc = pci_dev_reset_slot_function(dev, 0);
-	if (rc != -ENOTTY)
+	if (!rc)
 		return rc;
 	return pci_parent_bus_reset(dev, 0);
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux