drivers/acpi/apei/einj-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Sparse reports a warning for einj_initialized being a global symbol
that is not declared static. The variable is only used within
einj-core.c, so mark it static to limit its scope and resolve the warning.
Signed-off-by: Padmashree S S <padmashreess2006@gmail.com>
---
drivers/acpi/apei/einj-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c
index a9248af078f6..4a16c4b85a03 100644
--- a/drivers/acpi/apei/einj-core.c
+++ b/drivers/acpi/apei/einj-core.c
@@ -178,7 +178,7 @@ static DEFINE_MUTEX(einj_mutex);
/*
* Exported APIs use this flag to exit early if einj_probe() failed.
*/
-bool einj_initialized __ro_after_init;
+static bool einj_initialized __ro_after_init;
static void __iomem *einj_param;
static u32 v5param_size;
--
2.43.0
Hi Padmashree, kernel test robot noticed the following build errors: [auto build test ERROR on rafael-pm/linux-next] [also build test ERROR on rafael-pm/bleeding-edge linus/master v7.0-rc5 next-20260327] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Padmashree-S-S/ACPI-APEI-EINJ-make-einj_initialized-static/20260328-022553 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20260325034626.405366-1-padmashreess2006%40gmail.com patch subject: [PATCH] ACPI: APEI: EINJ: make einj_initialized static config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260328/202603282131.etycgFYz-lkp@intel.com/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260328/202603282131.etycgFYz-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202603282131.etycgFYz-lkp@intel.com/ All errors (new ones prefixed by >>, old ones prefixed by <<): >> ERROR: modpost: "einj_initialized" [drivers/acpi/apei/einj.ko] undefined! -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Padmashree, kernel test robot noticed the following build errors: [auto build test ERROR on rafael-pm/linux-next] [also build test ERROR on rafael-pm/bleeding-edge linus/master v7.0-rc5 next-20260327] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Padmashree-S-S/ACPI-APEI-EINJ-make-einj_initialized-static/20260328-022553 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20260325034626.405366-1-padmashreess2006%40gmail.com patch subject: [PATCH] ACPI: APEI: EINJ: make einj_initialized static config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260328/202603281058.fgnC9vIy-lkp@intel.com/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260328/202603281058.fgnC9vIy-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202603281058.fgnC9vIy-lkp@intel.com/ All errors (new ones prefixed by >>, old ones prefixed by <<): >> ERROR: modpost: "einj_initialized" [drivers/acpi/apei/einj.ko] undefined! -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
> Sparse reports a warning for einj_initialized being a global symbol > that is not declared static. The variable is only used within > einj-core.c, so mark it static to limit its scope and resolve the warning. "git grep" is your friend: $ git grep einj_initialized drivers/acpi/apei/einj-core.c:bool einj_initialized __ro_after_init; drivers/acpi/apei/einj-core.c: einj_initialized = true; drivers/acpi/apei/einj-cxl.c:extern bool einj_initialized; drivers/acpi/apei/einj-cxl.c: return einj_initialized; Ben, Dan: Is there some header file that could carry the declaration of einj_initialized instead of the "extern" in drivers/acpi/apei/einj-cxl.c -Tony
On 3/25/2026 10:41 AM, Luck, Tony wrote:
>> Sparse reports a warning for einj_initialized being a global symbol
>> that is not declared static. The variable is only used within
>> einj-core.c, so mark it static to limit its scope and resolve the warning.
>
> "git grep" is your friend:
>
> $ git grep einj_initialized
> drivers/acpi/apei/einj-core.c:bool einj_initialized __ro_after_init;
> drivers/acpi/apei/einj-core.c: einj_initialized = true;
> drivers/acpi/apei/einj-cxl.c:extern bool einj_initialized;
> drivers/acpi/apei/einj-cxl.c: return einj_initialized;
>
> Ben, Dan: Is there some header file that could carry the declaration of einj_initialized
> instead of the "extern" in drivers/acpi/apei/einj-cxl.c
It *could* go into include/cxl/einj.h, but it's not really a cxl-specific symbol. If you (and Dan) are
fine with muddying the waters on the cxl/einj divide, I think the patch below would work. I added a comment
to hopefully avoid confusion in the future, but I'm not attached to it. I haven't built or tested it,
so YMMV:
Subject: [PATCH] ACPI: APEI: EINJ: Move einj_cxl_is_initialized() to einj-core
Move einj_cxl_is_initialized() to einj-core.c to fix a sparse warning
about einj_initialized being a non-static global symbol.
Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
---
drivers/acpi/apei/einj-core.c | 8 ++++++++
drivers/acpi/apei/einj-cxl.c | 9 ---------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c
index 305c240a303f..6ec4fb3632ad 100644
--- a/drivers/acpi/apei/einj-core.c
+++ b/drivers/acpi/apei/einj-core.c
@@ -23,6 +23,7 @@
#include <linux/mm.h>
#include <linux/device/faux.h>
#include <linux/unaligned.h>
+#include <cxl/einj.h>
#include "apei-internal.h"
@@ -1173,6 +1174,13 @@ static struct faux_device_ops einj_device_ops = {
.remove = einj_remove,
};
+/* Used by CXL core to publish CXL-specific EINJ interface in CXL debugfs */
+bool einj_cxl_is_initialized(void)
+{
+ return einj_initialized;
+}
+EXPORT_SYMBOL_NS_GPL(einj_cxl_is_initialized, "CXL");
+
static int __init einj_init(void)
{
if (acpi_disabled) {
diff --git a/drivers/acpi/apei/einj-cxl.c b/drivers/acpi/apei/einj-cxl.c
index e70a416ec925..a3070988f2b4 100644
--- a/drivers/acpi/apei/einj-cxl.c
+++ b/drivers/acpi/apei/einj-cxl.c
@@ -13,9 +13,6 @@
#include "apei-internal.h"
-/* Defined in einj-core.c */
-extern bool einj_initialized;
-
static struct { u32 mask; const char *str; } const einj_cxl_error_type_string[] = {
{ ACPI_EINJ_CXL_CACHE_CORRECTABLE, "CXL.cache Protocol Correctable" },
{ ACPI_EINJ_CXL_CACHE_UNCORRECTABLE, "CXL.cache Protocol Uncorrectable non-fatal" },
@@ -105,9 +102,3 @@ int einj_cxl_inject_error(struct pci_dev *dport, u64 type)
return einj_error_inject(type, 0x4, 0, 0, 0, param4);
}
EXPORT_SYMBOL_NS_GPL(einj_cxl_inject_error, "CXL");
-
-bool einj_cxl_is_initialized(void)
-{
- return einj_initialized;
-}
-EXPORT_SYMBOL_NS_GPL(einj_cxl_is_initialized, "CXL");
--
2.52.0
base-commit: 63fbf275fa9f18f7020fb8acf54fa107e51d0f23 (cxl-next in cxl.git)
© 2016 - 2026 Red Hat, Inc.