]> git.baikalelectronics.ru Git - kernel.git/commitdiff
watchdog: sp5100_tco: Fix a memory leak of EFCH MMIO resource
authorJean Delvare <jdelvare@suse.de>
Tue, 21 Jun 2022 13:28:40 +0000 (15:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:24:11 +0000 (14:24 +0200)
[ 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 <jdelvare@suse.de>
Fixes: dabe269251d2 ("Watchdog: sp5100_tco: Add initialization using EFCH MMIO")
Cc: Terry Bowman <terry.bowman@amd.com>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220621152840.420a0f4c@endymion.delvare
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/watchdog/sp5100_tco.c

index 4820af929a826653af3f58648075f16e58a5d21f..4afc468d8ed12fdd0cc473aeea661c64ac333d65 100644 (file)
@@ -394,6 +394,7 @@ out:
                iounmap(addr);
 
        release_resource(res);
+       kfree(res);
 
        return ret;
 }