From: Joe Hattori Date: Sun, 5 Jan 2025 11:17:18 +0000 (+0900) Subject: watchdog: rti_wdt: Fix an OF node leak in rti_wdt_probe() X-Git-Tag: v6.14-rc1~88^2~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=143981aa63f33d469a55a55fd9fb81cd90109672;p=linux-2.6-block.git watchdog: rti_wdt: Fix an OF node leak in rti_wdt_probe() rti_wdt_probe() does not release the OF node reference obtained by of_parse_phandle(). Add a of_node_put() call. This was found by an experimental verification tool that I am developing. Due to the lack of the actual device, no runtime test was able to be performed. Fixes: f20ca595ae23 ("watchdog:rit_wdt: Add support for WDIOF_CARDRESET") Signed-off-by: Joe Hattori Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20250105111718.4184192-1-joe@pf.is.s.u-tokyo.ac.jp Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c index e01dd1c13e2c..d1f9ce4100a8 100644 --- a/drivers/watchdog/rti_wdt.c +++ b/drivers/watchdog/rti_wdt.c @@ -302,6 +302,7 @@ static int rti_wdt_probe(struct platform_device *pdev) node = of_parse_phandle(pdev->dev.of_node, "memory-region", 0); if (node) { ret = of_address_to_resource(node, 0, &res); + of_node_put(node); if (ret) { dev_err(dev, "No memory address assigned to the region.\n"); goto err_iomap;