2023-05-19 20:29:25

by Leo Li

[permalink] [raw]
Subject: [PATCH] apei/ghes: correctly return NULL for ghes_get_devices()

Since 315bada690e0 ("EDAC: Check for GHES preference in the
chipset-specific EDAC drivers"), vendor specific EDAC driver will not
probe correctly when CONFIG_ACPI_APEI_GHES is enabled but no GHES device
is present. Make ghes_get_devices() return NULL when the GHES device
list is empty to fix the problem.

Fixes: 9057a3f7ac36 ("EDAC/ghes: Prepare to make ghes_edac a proper module")
Signed-off-by: Li Yang <[email protected]>
Cc: Jia He <[email protected]>
---
drivers/acpi/apei/ghes.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 34ad071a64e9..da1a712f370b 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -1544,9 +1544,11 @@ struct list_head *ghes_get_devices(void)

pr_warn_once("Force-loading ghes_edac on an unsupported platform. You're on your own!\n");
}
+ } else if (list_empty(&ghes_devs)) {
+ return NULL;
+ } else {
+ return &ghes_devs;
}
-
- return &ghes_devs;
}
EXPORT_SYMBOL_GPL(ghes_get_devices);

--
2.38.0



2023-05-20 03:23:57

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] apei/ghes: correctly return NULL for ghes_get_devices()

Hi Li,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on linus/master v6.4-rc2 next-20230519]
[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/Li-Yang/apei-ghes-correctly-return-NULL-for-ghes_get_devices/20230520-043046
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link: https://lore.kernel.org/r/20230519200342.30817-1-leoyang.li%40nxp.com
patch subject: [PATCH] apei/ghes: correctly return NULL for ghes_get_devices()
config: x86_64-randconfig-a016
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/4964167d53fd894284d9954a8ae85ad0515fc112
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Li-Yang/apei-ghes-correctly-return-NULL-for-ghes_get_devices/20230520-043046
git checkout 4964167d53fd894284d9954a8ae85ad0515fc112
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/acpi/apei/ghes.c:1552:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
}
^
1 error generated.


vim +1552 drivers/acpi/apei/ghes.c

1534
1535 struct list_head *ghes_get_devices(void)
1536 {
1537 int idx = -1;
1538
1539 if (IS_ENABLED(CONFIG_X86)) {
1540 idx = acpi_match_platform_list(plat_list);
1541 if (idx < 0) {
1542 if (!ghes_edac_force_enable)
1543 return NULL;
1544
1545 pr_warn_once("Force-loading ghes_edac on an unsupported platform. You're on your own!\n");
1546 }
1547 } else if (list_empty(&ghes_devs)) {
1548 return NULL;
1549 } else {
1550 return &ghes_devs;
1551 }
> 1552 }
1553 EXPORT_SYMBOL_GPL(ghes_get_devices);
1554

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Attachments:
(No filename) (2.83 kB)
config (162.23 kB)
Download all attachments