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, 7 Jan 2023 11:07:14 +0000 (12:07 +0100)
commit170e9913c2ed5cfc37c0adf0fdbd368d2d8d8168
treee3025ce957f4fa01826e6e6c92a1724074416c97
parent0000281f019111526f7abccc61f2746d2eb626ca
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