From 0879de0e8b110da1d35db45f086c60cf777f2732 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 31 Aug 2023 11:20:53 -0600 Subject: [PATCH] x86: coreboot: Avoid a declaration after a label MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Declare the global_data pointer at the top of the file, to avoid an error: arch/x86/include/asm/global_data.h:143:35: error: a label can only be part of a statement and a declaration is not a statement board/coreboot/coreboot/coreboot.c:60:2: note: in expansion of macro ‘DECLARE_GLOBAL_DATA_PTR’ Signed-off-by: Simon Glass Reviewed-by: Mike Frysinger Reviewed-by: Bin Meng --- board/coreboot/coreboot/coreboot.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/board/coreboot/coreboot/coreboot.c b/board/coreboot/coreboot/coreboot.c index 3b90ae7538..db855c11ae 100644 --- a/board/coreboot/coreboot/coreboot.c +++ b/board/coreboot/coreboot/coreboot.c @@ -10,6 +10,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + int board_early_init_r(void) { /* @@ -54,14 +56,12 @@ int show_board_info(void) return 0; fallback: -#ifdef CONFIG_OF_CONTROL - DECLARE_GLOBAL_DATA_PTR; - - model = fdt_getprop(gd->fdt_blob, 0, "model", NULL); + if (IS_ENABLED(CONFIG_OF_CONTROL)) { + model = fdt_getprop(gd->fdt_blob, 0, "model", NULL); - if (model) - printf("Model: %s\n", model); -#endif + if (model) + printf("Model: %s\n", model); + } return checkboard(); } -- 2.39.5