i2c: piix4: Fix a memory leak in the EFCH MMIO support
authorJean Delvare <jdelvare@suse.de>
Wed, 22 Jun 2022 06:37:43 +0000 (08:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jul 2022 14:35:15 +0000 (16:35 +0200)
commitd2bf1a6480e8d44658a8ac3bdcec081238873212
tree548d3c7f58c029ff6e9cd99260acda1c989a8d98
parente7a1d51009217125e71b2287f0c57909bcca0914
i2c: piix4: Fix a memory leak in the EFCH MMIO support

[ Upstream commit 8ad59b397f86a4d8014966fdc0552095a0c4fb2b ]

The recently added support for EFCH MMIO regions introduced a memory
leak in that code path. The leak is caused by the fact that
release_resource() merely removes the resource from the tree but does
not free its memory. We need to call release_mem_region() instead,
which does free the memory. As a nice side effect, this brings back
some symmetry between the legacy and MMIO paths.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Tested-by: Yi Zhang <yi.zhang@redhat.com>
Reviewed-by: Terry Bowman <terry.bowman@amd.com>
Tested-by: Terry Bowman <Terry.Bowman@amd.com>
Fixes: 7c148722d074 ("i2c: piix4: Add EFCH MMIO support to region request and release")
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/i2c/busses/i2c-piix4.c