[Skiboot] [PATCH 07/10] phb4: Simplify calling phb4_retry_state()

Michael Neuling mikey at neuling.org
Thu Jul 20 16:22:17 AEST 2017


phb4_retry_state() returns a good error code, so just use that rather
than complicating the caller.

Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 hw/phb4.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/hw/phb4.c b/hw/phb4.c
index da1eaa1150..f72eb6f962 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -2188,7 +2188,6 @@ static int64_t phb4_poll_link(struct pci_slot *slot)
 {
 	struct phb4 *p = phb_to_phb4(slot->phb);
 	uint64_t reg;
-	int64_t rc;
 
 	switch (slot->state) {
 	case PHB4_SLOT_NORMAL:
@@ -2220,12 +2219,7 @@ static int64_t phb4_poll_link(struct pci_slot *slot)
 		if (slot->retries-- == 0) {
 			PHBERR(p, "LINK: Timeout waiting for electrical link\n");
 			PHBDBG(p, "LINK: DLP train control: 0x%016llx\n", reg);
-			rc = phb4_retry_state(slot);
-			if (rc >= OPAL_SUCCESS)
-				return rc;
-
-			pci_slot_set_state(slot, PHB4_SLOT_NORMAL);
-			return OPAL_SUCCESS;
+			return phb4_retry_state(slot);
 		}
 		return pci_slot_set_sm_timeout(slot, msecs_to_tb(100));
 	case PHB4_SLOT_LINK_WAIT:
@@ -2241,9 +2235,7 @@ static int64_t phb4_poll_link(struct pci_slot *slot)
 		if (slot->retries-- == 0) {
 			PHBERR(p, "LINK: Timeout waiting for link up\n");
 			PHBDBG(p, "LINK: DLP train control: 0x%016llx\n", reg);
-			rc = phb4_retry_state(slot);
-			if (rc >= OPAL_SUCCESS)
-				return rc;
+			return phb4_retry_state(slot);
 
 			pci_slot_set_state(slot, PHB4_SLOT_NORMAL);
 			return OPAL_SUCCESS;
-- 
2.11.0



More information about the Skiboot mailing list