cxl: Fix refcount leak in cxl_calc_capp_routing
authorMiaoqian Lin <linmq006@gmail.com>
Sun, 5 Jun 2022 06:00:38 +0000 (10:00 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:50 +0000 (13:32 +0100)
commit2d7b6580384e6d65419933ddc525bd176095da54
treeff103758704c163d7a6ccbf1ebb9c78a29576772
parentfb3ef6a5af4b003502c940ea50c0f55b06ebbfc9
cxl: Fix refcount leak in cxl_calc_capp_routing

[ Upstream commit 1d09697ff22908ae487fc8c4fbde1811732be523 ]

of_get_next_parent() returns a node pointer with refcount incremented,
we should use of_node_put() on it when not need anymore.
This function only calls of_node_put() in normal path,
missing it in the error path.
Add missing of_node_put() to avoid refcount leak.

Fixes: f24be42aab37 ("cxl: Add psl9 specific code")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220605060038.62217-1-linmq006@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/misc/cxl/pci.c