ghes, EDAC: Fix ghes_edac registration
Quoted 87 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Tony reported seeing
"Internal error: Can't find EDAC structure"
when injecting correctable errors due to the fact that
ghes_edacwould still load even if the whitelist won't hit. Drop thepr_err()inghes_edac_report_mem_error()for now due to the hacky way howghes_edacdepends onghes.c.While at it, make
ghes_edac_register()return an error if it doesn't hit in the whitelist as it is the only sensible thing to do in that situation.Furthermore, move the call to it to happen last in
ghes_probe()so that GHES initializing properly does not depend onghes_edacinit at all as latter is only reporting errors and not required for GHES's proper functioning.Signed-off-by Borislav Petkov <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>Cc Tony Luck <[email protected]>Cc Toshi Kani <[email protected]>--- drivers/acpi/apei/ghes.c | 14 ++++++-------- drivers/edac/ghes_edac.c | 6 ++---- include/acpi/ghes.h | 2 +- 3 files changed, 9 insertions(+), 13 deletions(-)drivers/acpi/apei/ghes.c +6
-8@@ -1087,10 +1087,6 @@ static int ghes_probe(struct platform_device *ghes_dev) goto err; } - rc =ghes_edac_register (ghes, &ghes_dev->dev); -if (rc <0 ) - goto err; -switch (generic->notify.type) {case ACPI_HEST_NOTIFY_POLLED :timer_setup (&ghes->timer, ghes_poll_func,TIMER_DEFERRABLE );@@ -1102,14 +1098,14 @@ static int ghes_probe(struct platform_device *ghes_dev)if (rc) {pr_err (GHES_PFX "Failed to map GSI to IRQ for generic hardware error source: %d\n" , generic->header.source_id); - goto err_edac_unreg; + goto err; } rc =request_irq (ghes->irq, ghes_irq_func,IRQF_SHARED ,"GHES IRQ" , ghes);if (rc) {pr_err (GHES_PFX "Failed to register IRQ for generic hardware error source: %d\n" , generic->header.source_id); - goto err_edac_unreg; + goto err; }break ;@@ -1132,14 +1128,16 @@ static int ghes_probe(struct platform_device *ghes_dev)default :BUG (); } +platform_set_drvdata (ghes_dev, ghes); +ghes_edac_register (ghes, &ghes_dev->dev); +/* Handle any pending errors right away */ ghes_proc (ghes);return 0 ; -err_edac_unreg: -ghes_edac_unregister (ghes); + err:if (ghes) {ghes_fini (ghes);drivers/edac/ghes_edac.c +0
-0
drivers/edac/ghes_edac.c void ghes_edac_report_mem_error(struct ghes *ghes, int sev, · line 188
Quoted 9 lines
drivers/edac/ghes_edac.c +1
-3@@ -183,10 +183,8 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev,char *p;u8 grain_bits; -if (!pvt) { -pr_err ("Internal error: Can't find EDAC structure\n" ); +if (!pvt)return ; - }
I think we need the same 'if (!ghes_pvt)' check in ghes_edac_unregister().
Thanks,
-Toshi