linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: rework error checking in the reset path
@ 2017-10-23 21:36 Sinan Kaya
  2017-10-25 13:45 ` Bjorn Helgaas
  0 siblings, 1 reply; 6+ messages in thread
From: Sinan Kaya @ 2017-10-23 21:36 UTC (permalink / raw)
  To: linux-pci, timur
  Cc: Sinan Kaya, linux-arm-msm, Bjorn Helgaas, linux-kernel,
	linux-arm-kernel

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@codeaurora.org>
---
 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-25 22:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-23 21:36 [PATCH] PCI: rework error checking in the reset path Sinan Kaya
2017-10-25 13:45 ` Bjorn Helgaas
2017-10-25 21:28   ` Alex Williamson
2017-10-25 21:42     ` Sinan Kaya
2017-10-25 22:10     ` Bjorn Helgaas
2017-10-25 22:34       ` Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).