Skip to contentSkip to conversation

EDAC, ghes: Do not register instance if platform is not whitelisted

DISCUSSION Toshi Kani 1 participant 1 message Apr 23, 2018 EDAC-core

lore
Share & tools
lore

Toshi Kani

author
#0 lore raw
Quoted 28 lines · Borislav Petkov

Lemme write an official patch:

---
Tony reported seeing

"Internal error: Can't find EDAC structure"

when injecting correctable errors.

The problem is that we should exit registration when platform doesn't match the whitelisted ones.

Do that.

---
 drivers/edac/ghes_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/ghes_edac.c +0 -0
index 68b6ee18bea6..4a9231993699 100644

drivers/edac/ghes_edac.c int ghes_edac_register(struct ghes *ghes, struct device *dev) · line 443

Quoted 6 lines
drivers/edac/ghes_edac.c +1 -1
@@ -439,7 +439,7 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev)
 	/* Check if safe to enable on this system */
 	idx = acpi_match_platform_list(plat_list);
 	if (!force_load && idx < 0)
-		return 0;
+		return -ENODEV;
 

Umm..., I do not think this change is correct. This causes an error to ghes_probe(), which disables GHES itself. ghes and ghes_edac are separate modules. That is, ghes_edac works on top of ghes as an optional module.

I think the right fix is to simply remove the error message. This will make it consistent with the case of CONFIG_EDAC_GHES disabled. Please see include/acpi/ghes.h.

Thanks,
-Toshi