Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Goldsworthy <cgoldswo@codeaurora.org>2019-10-19 18:57:24 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-29 09:22:47 +0100
commitd07e3066ffa045e7ec5f81ca67951b03f3bfb97c (patch)
treecb12595b969889d6fa9860cbdec14c10b6d28493
parent99f8ef99333f734f242b8dc0de44a474ac6a8b52 (diff)
of: reserved_mem: add missing of_node_put() for proper ref-counting
commit 5dba51754b04a941a1064f584e7a7f607df3f9bc upstream. Commit d698a388146c ("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: d698a388146c ("of: reserved-memory: ignore disabled memory-region nodes") Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org> Cc: stable@vger.kernel.org Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/of/of_reserved_mem.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 7989703b883c..6bd610ee2cd7 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -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);