Re: [PATCH] platform/x86: wdat_wdt: Fix ACPI table leak on probe errors
From: Guenter Roeck
Date: Wed Nov 12 2025 - 15:02:39 EST
On 11/10/25 19:28, Haotian Zhang wrote:
wdat_wdt_probe() calls acpi_get_table() to obtain the WDAT ACPI table but
returns early on multiple error paths without calling acpi_put_table().
It _never_ calls acpi_put_table().
This causes a permanent ACPI table memory leak if the driver probe fails.Seems to me that itdoesn't just cause a table leak if probe fails.
Add a single cleanup path which calls acpi_put_table() and redirect all
error returns to it, ensuring the ACPI table is always released.
Fixes: 058dfc767008 ("ACPI / watchdog: Add support for WDAT hardware watchdog")
Signed-off-by: Haotian Zhang <vulab@xxxxxxxxxxx>
---
drivers/watchdog/wdat_wdt.c | 66 ++++++++++++++++++++++++-------------
1 file changed, 44 insertions(+), 22 deletions(-)
diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
index 650fdc7996e1..f827844a0c69 100644
--- a/drivers/watchdog/wdat_wdt.c
+++ b/drivers/watchdog/wdat_wdt.c
@@ -318,7 +318,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)
struct resource *res;
void __iomem **regs;
acpi_status status;
- int i, ret;
+ int i, ret = 0;
Unnecessary initialization.
Guenter