aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2025-12-26 15:36:24 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2025-12-26 15:36:24 +0000
commit88f8e3c5ab97025587d7df761c8ae72e2db6c1d3 (patch)
tree1267ddb428544a7f66b46b93a98abba614e37238
parent5b39245ab6f37450fd025127b4fc76b5e5ba135e (diff)
acpi_apei: Remove the hest member from the softc
This is only used during attach and freed after use, so just use a local variable in the attach routine instead to avoid leaving a dangling pointer around in the softc. Reviewed by: imp Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D54310
-rw-r--r--sys/dev/acpica/acpi_apei.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/dev/acpica/acpi_apei.c b/sys/dev/acpica/acpi_apei.c
index 0d23b504cb60..e85b3910e46d 100644
--- a/sys/dev/acpica/acpi_apei.c
+++ b/sys/dev/acpica/acpi_apei.c
@@ -86,7 +86,6 @@ struct apei_pges {
};
struct apei_softc {
- ACPI_TABLE_HEST *hest;
TAILQ_HEAD(, apei_ge) ges;
struct apei_nges nges;
struct apei_iges iges;
@@ -562,9 +561,8 @@ hest_parse_structure(struct apei_softc *sc, void *addr, int remaining)
}
static void
-hest_parse_table(struct apei_softc *sc)
+hest_parse_table(ACPI_TABLE_HEST *hest, struct apei_softc *sc)
{
- ACPI_TABLE_HEST *hest = sc->hest;
char *cp;
int remaining, consumed;
@@ -662,6 +660,7 @@ static int
apei_attach(device_t dev)
{
struct apei_softc *sc = device_get_softc(dev);
+ ACPI_TABLE_HEADER *hest;
struct acpi_softc *acpi_sc;
struct apei_pges *pges;
struct apei_ge *ge;
@@ -691,11 +690,11 @@ apei_attach(device_t dev)
}
/* Search and parse HEST table. */
- status = AcpiGetTable(ACPI_SIG_HEST, 0, (ACPI_TABLE_HEADER **)&sc->hest);
+ status = AcpiGetTable(ACPI_SIG_HEST, 0, &hest);
if (ACPI_FAILURE(status))
return (ENXIO);
- hest_parse_table(sc);
- AcpiPutTable((ACPI_TABLE_HEADER *)sc->hest);
+ hest_parse_table((ACPI_TABLE_HEST *)hest, sc);
+ AcpiPutTable(hest);
rid = 0;
TAILQ_FOREACH(ge, &sc->ges, link) {