From 33beaab2ffd2c0f61b6faf8e3ef3e8e24323f849 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 21 Jun 2022 15:28:40 +0200 Subject: [PATCH] watchdog: sp5100_tco: Fix a memory leak of EFCH MMIO resource [ Upstream commit 8ef4f15362e35f25aef76355de8258aaae88cc66 ] Unlike release_mem_region(), a call to release_resource() does not free the resource, so it has to be freed explicitly to avoid a memory leak. Signed-off-by: Jean Delvare Fixes: dabe269251d2 ("Watchdog: sp5100_tco: Add initialization using EFCH MMIO") Cc: Terry Bowman Cc: Wim Van Sebroeck Cc: Guenter Roeck Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220621152840.420a0f4c@endymion.delvare Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/sp5100_tco.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c index 4820af929a826..4afc468d8ed12 100644 --- a/drivers/watchdog/sp5100_tco.c +++ b/drivers/watchdog/sp5100_tco.c @@ -394,6 +394,7 @@ out: iounmap(addr); release_resource(res); + kfree(res); return ret; } -- 2.39.5