soc: qcom: ocmem: Fix refcount leak in of_get_ocmem
authorMiaoqian Lin <linmq006@gmail.com>
Thu, 2 Jun 2022 04:24:30 +0000 (08:24 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:10 +0000 (14:23 +0200)
commit84a928b44cb303d5756e3bff2734921de8dce4f6
tree18071a315f81d75615a0f1ed594e3a3043b0a62c
parente89261b18c4e13706365bf0198763efd2a37513a
soc: qcom: ocmem: Fix refcount leak in of_get_ocmem

[ Upstream commit 92a563fcf14b3093226fb36f12e9b5cf630c5a5d ]

of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Add missing of_node_put() to avoid refcount leak.
of_node_put() will check NULL pointer.

Fixes: 88c1e9404f1d ("soc: qcom: add OCMEM driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220602042430.1114-1-linmq006@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soc/qcom/ocmem.c