The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] platform/x86/amd/hsmp: fix compile-testing without CONFiG_AMD_NB
@ 2024-10-29  9:23 Arnd Bergmann
  2024-10-29 10:33 ` Borislav Petkov
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Arnd Bergmann @ 2024-10-29  9:23 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Mario Limonciello,
	Bjorn Helgaas, Yazen Ghannam, Suma Hegde,
	Naveen Krishna Chatradhi, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

node_to_amd_nb() is defined to NULL in non-AMD configs:

drivers/platform/x86/amd/hsmp/plat.c: In function 'init_platform_device':
drivers/platform/x86/amd/hsmp/plat.c:165:68: error: dereferencing 'void *' pointer [-Werror]
  165 |                 sock->root                      = node_to_amd_nb(i)->root;
      |                                                                    ^~
drivers/platform/x86/amd/hsmp/plat.c:165:68: error: request for member 'root' in something not a structure or union

Change the definition to something that builds. This does introduce a
NULL pointer dereference but the code is never called since the driver
won't probe successfully.

Fixes: 7d3135d16356 ("platform/x86/amd/hsmp: Create separate ACPI, plat and common drivers")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/amd_nb.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h
index 6f3b6aef47ba..d0caac26533f 100644
--- a/arch/x86/include/asm/amd_nb.h
+++ b/arch/x86/include/asm/amd_nb.h
@@ -116,7 +116,10 @@ static inline bool amd_gart_present(void)
 
 #define amd_nb_num(x)		0
 #define amd_nb_has_feature(x)	false
-#define node_to_amd_nb(x)	NULL
+static inline struct amd_northbridge *node_to_amd_nb(int node)
+{
+	return NULL;
+}
 #define amd_gart_present(x)	false
 
 #endif
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-10-29 17:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29  9:23 [PATCH] platform/x86/amd/hsmp: fix compile-testing without CONFiG_AMD_NB Arnd Bergmann
2024-10-29 10:33 ` Borislav Petkov
2024-10-29 10:56   ` Arnd Bergmann
2024-10-29 11:06     ` Borislav Petkov
2024-10-29 12:40       ` Ilpo Järvinen
2024-10-29 14:11         ` Borislav Petkov
2024-10-29 15:04           ` Ilpo Järvinen
2024-10-29 12:39 ` Ilpo Järvinen
2024-10-29 15:11   ` Borislav Petkov
2024-10-29 15:19     ` Ilpo Järvinen
2024-10-29 15:59       ` Borislav Petkov
2024-10-29 17:35 ` [tip: x86/urgent] x86/amd_nb: Fix compile-testing without CONFIG_AMD_NB tip-bot2 for Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox