Re: [PATCH] platform/x86/amd/hsmp: fix compile-testing without CONFiG_AMD_NB
From: Borislav Petkov
Date: Tue Oct 29 2024 - 06:33:54 EST
On Tue, Oct 29, 2024 at 09:23:20AM +0000, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> 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")
^^^^^^^^^^^^
I'm guessing this is queued for 6.13...
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> 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
... so this fix should go to Linus now so that build testing doesn't break?
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette