From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Mario Limonciello <mario.limonciello@amd.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Yazen Ghannam <yazen.ghannam@amd.com>,
Suma Hegde <suma.hegde@amd.com>,
Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] platform/x86/amd/hsmp: fix compile-testing without CONFiG_AMD_NB
Date: Tue, 29 Oct 2024 14:39:41 +0200 (EET) [thread overview]
Message-ID: <a6f9a5aa-3208-7d03-93a0-768fd0805fdc@linux.intel.com> (raw)
In-Reply-To: <20241029092329.3857004-1-arnd@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1948 bytes --]
On Tue, 29 Oct 2024, Arnd Bergmann wrote:
> 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.
I don't like this very wording because what the code very much does is
NULL check on node_to_amd_nb() which leads to immediate failure of
.probe(). (We don't call other deferences after a NULL check "NULL pointer
dereference" either so none is introduced by this patch, IMO.)
With that fixed,
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
> 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
>
next prev parent reply other threads:[~2024-10-29 12:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a6f9a5aa-3208-7d03-93a0-768fd0805fdc@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=mingo@redhat.com \
--cc=naveenkrishna.chatradhi@amd.com \
--cc=suma.hegde@amd.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=yazen.ghannam@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.