MIPS: vpe-cmp: fix possible memory leak while module exiting
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 4 Nov 2022 03:39:45 +0000 (11:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Jan 2023 11:07:14 +0000 (12:07 +0100)
commitc5b088a6bbbbf0ef8199a41bf0d82638429ed0fd
treea3befcdd21f808994ecbffcc8a1fb5020ab265d5
parent170e9913c2ed5cfc37c0adf0fdbd368d2d8d8168
MIPS: vpe-cmp: fix possible memory leak while module exiting

[ Upstream commit c5ed1fe0801f0c66b0fbce2785239a5664629057 ]

dev_set_name() allocates memory for name, it need be freed
when module exiting, call put_device() to give up reference,
so that it can be freed in kobject_cleanup() when the refcount
hit to 0. The vpe_device is static, so remove kfree() from
vpe_device_release().

Fixes: 17a1d523aa58 ("MIPS: APRP: Add VPE loader support for CMP platforms.")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/mips/kernel/vpe-cmp.c