You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
soc: qcom: ocmem: Fix refcount leak in of_get_ocmem
[ Upstream commit92a563fcf1] 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:88c1e9404f("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
71042279b1
commit
07aea6819d
@@ -194,14 +194,17 @@ struct ocmem *of_get_ocmem(struct device *dev)
|
||||
devnode = of_parse_phandle(dev->of_node, "sram", 0);
|
||||
if (!devnode || !devnode->parent) {
|
||||
dev_err(dev, "Cannot look up sram phandle\n");
|
||||
of_node_put(devnode);
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
pdev = of_find_device_by_node(devnode->parent);
|
||||
if (!pdev) {
|
||||
dev_err(dev, "Cannot find device node %s\n", devnode->name);
|
||||
of_node_put(devnode);
|
||||
return ERR_PTR(-EPROBE_DEFER);
|
||||
}
|
||||
of_node_put(devnode);
|
||||
|
||||
ocmem = platform_get_drvdata(pdev);
|
||||
if (!ocmem) {
|
||||
|
||||
Reference in New Issue
Block a user