linux-stable/arch/powerpc
Oliver O'Halloran 157616f3c2 powerpc/eeh: Use a goto for recovery failures
The EEH recovery logic in eeh_handle_normal_event() has some pretty strange
flow control. If we remove all the actual recovery logic we're left with
the following skeleton:

	if (result != PCI_ERS_RESULT_DISCONNECT) {
		...
	}

	if (result != PCI_ERS_RESULT_DISCONNECT) {
		...
	}

	if (result == PCI_ERS_RESULT_NONE) {
		...
	}

	if (result == PCI_ERS_RESULT_CAN_RECOVER) {
		...
	}

	if (result == PCI_ERS_RESULT_CAN_RECOVER) {
		...
	}

	if (result == PCI_ERS_RESULT_NEED_RESET) {
		...
	}

	if ((result == PCI_ERS_RESULT_RECOVERED) ||
	    (result == PCI_ERS_RESULT_NONE)) {
		...
		goto out;
	}

	/*
	 * unsuccessful recovery / PCI_ERS_RESULT_DISCONECTED
	 * handling is here.
	 */
	...

	out:
	...

Most of the "if () { ... }" blocks above change "result" to
PCI_ERS_RESULT_DISCONNECTED if an error occurs in that recovery step. This
makes the control flow a bit confusing since it breaks the early-exit
pattern that is generally used in Linux. In any case we end up handling the
error in the final else block so why not just jump there directly? Doing so
also allows us to de-indent a bunch of code.

No functional changes.

[dja: rebase on top of linux-next + my preceeding refactor,
      move clearing the EEH_DEV_NO_HANDLER bit above the first goto so that
      it is always clear in the error handler code as it was before.]

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
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-2-dja@axtens.net
2021-11-25 11:25:31 +11:00
..
boot powerpc updates for 5.16 2021-11-05 08:15:46 -07:00
configs Merge branch 'akpm' (patches from Andrew) 2021-11-06 14:08:17 -07:00
crypto
include powerpc/xive: Activate StoreEOI on P10 2021-11-25 11:25:30 +11:00
kernel powerpc/eeh: Use a goto for recovery failures 2021-11-25 11:25:31 +11:00
kexec powerpc/machdep: Remove stale functions from ppc_md structure 2021-10-22 15:22:05 +11:00
kvm KVM: PPC: Book3S HV P9: Remove subcore HMI handling 2021-11-24 21:09:03 +11:00
lib Kbuild updates for v5.16 2021-11-08 09:15:45 -08:00
math-emu powerpc/64s: avoid reloading (H)SRR registers if they are still valid 2021-06-25 00:06:55 +10:00
mm powerpc/64s: Keep AMOR SPR a constant ~0 at runtime 2021-11-24 21:08:57 +11:00
net powerpc updates for 5.16 2021-11-05 08:15:46 -07:00
perf powerpc/64s: Implement PMU override command line option 2021-11-24 21:08:57 +11:00
platforms powerpc/powernv: Remove POWER9 PVR version check for entry and uaccess flushes 2021-11-25 11:25:29 +11:00
purgatory
sysdev powerpc/xive: Add a debugfs toggle for save-restore 2021-11-25 11:25:31 +11:00
tools powerpc/head_check: Fix shellcheck errors 2021-08-17 22:52:02 +10:00
xmon powerpc/64s: guard optional TIDR SPR with CPU ftr test 2021-11-24 21:08:56 +11:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig powerpc/64s: Default to 64K pages for 64 bit book3s 2021-10-27 22:31:22 +11:00
Kconfig.debug powerpc/ptdump: Convert powerpc to GENERIC_PTDUMP 2021-08-25 13:35:48 +10:00
Makefile Kbuild updates for v5.16 2021-11-08 09:15:45 -08:00
Makefile.postlink