Commit 5dba5175 authored by Chris Goldsworthy's avatar Chris Goldsworthy Committed by Rob Herring

of: reserved_mem: add missing of_node_put() for proper ref-counting

Commit d698a388 ("of: reserved-memory: ignore disabled memory-region
nodes") added an early return in of_reserved_mem_device_init_by_idx(), but
didn't call of_node_put() on a device_node whose ref-count was incremented
in the call to of_parse_phandle() preceding the early exit.

Fixes: d698a388 ("of: reserved-memory: ignore disabled memory-region nodes")
Signed-off-by: default avatarChris Goldsworthy <cgoldswo@codeaurora.org>
Cc: stable@vger.kernel.org
Reviewed-by: Bjorn Andersson's avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Rob Herring's avatarRob Herring <robh@kernel.org>
parent e13de8fe
......@@ -324,8 +324,10 @@ int of_reserved_mem_device_init_by_idx(struct device *dev,
if (!target)
return -ENODEV;
if (!of_device_is_available(target))
if (!of_device_is_available(target)) {
of_node_put(target);
return 0;
}
rmem = __find_rmem(target);
of_node_put(target);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment