[PATCH 4/8] mips: octeon: nic23: Handle return value from cyclic_register()

Marek Vasut marek.vasut+renesas at mailbox.org
Sat Jan 18 05:00:58 CET 2025


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 <marek.vasut+renesas at mailbox.org>
---
Cc: Aaron Williams <awilliams at marvell.com>
Cc: Anatolij Gustschin <agust at denx.de>
Cc: Angelo Dureghello <angelo at kernel-space.org>
Cc: Christian Marangi <ansuelsmth at gmail.com>
Cc: Devarsh Thakkar <devarsht at ti.com>
Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
Cc: Jaehoon Chung <jh80.chung at samsung.com>
Cc: Michael Polyntsov <michael.polyntsov at iopsys.eu>
Cc: Michael Trimarchi <michael at amarulasolutions.com>
Cc: Nikhil M Jain <n-jain1 at ti.com>
Cc: Peng Fan <peng.fan at nxp.com>
Cc: Peter Robinson <pbrobinson at gmail.com>
Cc: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
Cc: Ronald Wahl <ronald.wahl at legrand.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Stefan Roese <sr at denx.de>
Cc: Tim Harvey <tharvey at gateworks.com>
Cc: Tom Rini <trini at konsulko.com>
Cc: u-boot at lists.denx.de
---
 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



More information about the U-Boot mailing list