HSI: omap_ssi_core: fix possible memory leak in ssi_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Mon, 31 Oct 2022 07:43:37 +0000 (15:43 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:44 +0000 (13:32 +0100)
commitfa80f145e543421f8ef985ad1915f834d73fd842
tree837a3532ef763fe733857472c222c8bd6f689215
parent8159e2f8b60ea3a7d818e2eda235577a67b1a03e
HSI: omap_ssi_core: fix possible memory leak in ssi_probe()

[ Upstream commit 1aff514e1d2bd47854dbbdf867970b9d463d4c57 ]

If ssi_add_controller() returns error, it should call hsi_put_controller()
to give up the reference that was set in hsi_alloc_controller(), so that
it can call hsi_controller_release() to free controller and ports that
allocated in hsi_alloc_controller().

Fixes: b209e047bc74 ("HSI: Introduce OMAP SSI driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hsi/controllers/omap_ssi_core.c