Handle the error code returned by cyclic_register(). Report the error, but do not return it from board_late_init() as that would make the board not boot, which is undesired. Let the board boot somehow, so the user can fix the problem, even if the cyclic callback is not usable.
Signed-off-by: Marek Vasut <[email protected]> --- Cc: Aaron Williams <[email protected]> Cc: Anatolij Gustschin <[email protected]> Cc: Angelo Dureghello <[email protected]> Cc: Christian Marangi <[email protected]> Cc: Devarsh Thakkar <[email protected]> Cc: Heinrich Schuchardt <[email protected]> Cc: Jaehoon Chung <[email protected]> Cc: Michael Polyntsov <[email protected]> Cc: Michael Trimarchi <[email protected]> Cc: Nikhil M Jain <[email protected]> Cc: Peng Fan <[email protected]> Cc: Peter Robinson <[email protected]> Cc: Rasmus Villemoes <[email protected]> Cc: Ronald Wahl <[email protected]> Cc: Simon Glass <[email protected]> Cc: Stefan Roese <[email protected]> Cc: Tim Harvey <[email protected]> Cc: Tom Rini <[email protected]> Cc: [email protected] --- board/Marvell/octeon_nic23/board.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/board/Marvell/octeon_nic23/board.c b/board/Marvell/octeon_nic23/board.c index cf20c97684a..5d1bf15ed50 100644 --- a/board/Marvell/octeon_nic23/board.c +++ b/board/Marvell/octeon_nic23/board.c @@ -341,6 +341,7 @@ int board_late_init(void) struct cyclic_info *cyclic; struct gpio_desc gpio = {}; ofnode node; + int ret; /* Turn on SFP+ transmitters */ ofnode_for_each_compatible_node(node, "ethernet,sfp-slot") { @@ -358,13 +359,18 @@ int board_late_init(void) /* Register cyclic function for PCIe FLR fixup */ cyclic = calloc(1, sizeof(*cyclic)); - if (cyclic) { - cyclic_register(cyclic, octeon_board_restore_pf, 100, - "pcie_flr_fix"); - } else { - printf("Registering of cyclic function failed\n"); + if (!cyclic) { + printf("Registering of cyclic function failed, ENOMEM\n"); + /* Do not exit with error code, let the board boot somehow. */ + return 0; } + ret = cyclic_register(cyclic, octeon_board_restore_pf, 100, + "pcie_flr_fix"); + /* Do not exit with error code, let the board boot somehow. */ + if (ret) + printf("Registering of cyclic function failed, %d\n", ret); + return 0; } -- 2.45.2

