MIPS: vpe-mt: fix possible memory leak while module exiting
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 4 Nov 2022 03:39:44 +0000 (11:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:02 +0000 (13:14 +0100)
commite820a8192ff68570100347855b567512aec43819
tree8c07fec0b036d2e398d4351a105f205e6292e30a
parent61d68cf2ba79128c48d4b3fa4d10c34dc18ba572
MIPS: vpe-mt: fix possible memory leak while module exiting

[ Upstream commit 5822e8cc84ee37338ab0bdc3124f6eec04dc232d ]

Afer commit 1fa5ae857bb1 ("driver core: get rid of struct device's
bus_id string array"), the name of device is allocated dynamically,
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: 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array")
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-mt.c