powerpc/eeh: Small refactor of eeh_handle_normal_event()
authorDaniel Axtens <dja@axtens.net>
Fri, 15 Oct 2021 07:06:27 +0000 (18:06 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 25 Nov 2021 00:25:31 +0000 (11:25 +1100)
The control flow of eeh_handle_normal_event() is a bit tricky.

Break out one of the error handling paths - rather than be in an else
block, we'll make it part of the regular body of the function and put a
'goto out;' in the true limb of the if.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211015070628.1331635-1-dja@axtens.net
arch/powerpc/kernel/eeh_driver.c

index 350dab1..b676fc0 100644 (file)
@@ -1054,45 +1054,46 @@ void eeh_handle_normal_event(struct eeh_pe *pe)
                }
 
                pr_info("EEH: Recovery successful.\n");
-       } else  {
-               /*
-                * About 90% of all real-life EEH failures in the field
-                * are due to poorly seated PCI cards. Only 10% or so are
-                * due to actual, failed cards.
-                */
-               pr_err("EEH: Unable to recover from failure from PHB#%x-PE#%x.\n"
-                      "Please try reseating or replacing it\n",
-                       pe->phb->global_number, pe->addr);
+               goto out;
+       }
 
-               eeh_slot_error_detail(pe, EEH_LOG_PERM);
+       /*
+        * About 90% of all real-life EEH failures in the field
+        * are due to poorly seated PCI cards. Only 10% or so are
+        * due to actual, failed cards.
+        */
+       pr_err("EEH: Unable to recover from failure from PHB#%x-PE#%x.\n"
+               "Please try reseating or replacing it\n",
+               pe->phb->global_number, pe->addr);
 
-               /* Notify all devices that they're about to go down. */
-               eeh_set_channel_state(pe, pci_channel_io_perm_failure);
-               eeh_set_irq_state(pe, false);
-               eeh_pe_report("error_detected(permanent failure)", pe,
-                             eeh_report_failure, NULL);
+       eeh_slot_error_detail(pe, EEH_LOG_PERM);
 
-               /* Mark the PE to be removed permanently */
-               eeh_pe_state_mark(pe, EEH_PE_REMOVED);
+       /* Notify all devices that they're about to go down. */
+       eeh_set_channel_state(pe, pci_channel_io_perm_failure);
+       eeh_set_irq_state(pe, false);
+       eeh_pe_report("error_detected(permanent failure)", pe,
+                     eeh_report_failure, NULL);
 
-               /*
-                * Shut down the device drivers for good. We mark
-                * all removed devices correctly to avoid access
-                * the their PCI config any more.
-                */
-               if (pe->type & EEH_PE_VF) {
-                       eeh_pe_dev_traverse(pe, eeh_rmv_device, NULL);
-                       eeh_pe_dev_mode_mark(pe, EEH_DEV_REMOVED);
-               } else {
-                       eeh_pe_state_clear(pe, EEH_PE_PRI_BUS, true);
-                       eeh_pe_dev_mode_mark(pe, EEH_DEV_REMOVED);
+       /* Mark the PE to be removed permanently */
+       eeh_pe_state_mark(pe, EEH_PE_REMOVED);
 
-                       pci_lock_rescan_remove();
-                       pci_hp_remove_devices(bus);
-                       pci_unlock_rescan_remove();
-                       /* The passed PE should no longer be used */
-                       return;
-               }
+       /*
+        * Shut down the device drivers for good. We mark
+        * all removed devices correctly to avoid access
+        * the their PCI config any more.
+        */
+       if (pe->type & EEH_PE_VF) {
+               eeh_pe_dev_traverse(pe, eeh_rmv_device, NULL);
+               eeh_pe_dev_mode_mark(pe, EEH_DEV_REMOVED);
+       } else {
+               eeh_pe_state_clear(pe, EEH_PE_PRI_BUS, true);
+               eeh_pe_dev_mode_mark(pe, EEH_DEV_REMOVED);
+
+               pci_lock_rescan_remove();
+               pci_hp_remove_devices(bus);
+               pci_unlock_rescan_remove();
+               /* The passed PE should no longer be used */
+               return;
        }
 
 out: