Skip to contentSkip to conversation

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

PATCH Applied Chris Goldsworthy 3 participants 4 messages Oct 20, 2019 – Oct 23, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

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")

To: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 drivers/of/of_reserved_mem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/of/of_reserved_mem.c +3 -1
index 7989703..6bd610e 100644
@@ -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);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Chris Goldsworthy

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.

Quoted 8 lines
Fixes d698a388146c ("of: reserved-memory: ignore disabled memory-region nodes")

To: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Cc stable@ is used to assist in making sure your patch is backported to stable kernels, other than that the purpose Cc here is to indicate that specific people have been requested to comment on your patch.

So please skip these from the commit message in the future (for this one, wait and see if Rob is willing to trim them as he applies the patch).

Regards,
Bjorn

Quoted 24 lines
---
 drivers/of/of_reserved_mem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/of/of_reserved_mem.c +3 -1
index 7989703..6bd610e 100644
@@ -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);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw

Hi Bjorn,

Quoted 5 lines · Bjorn Andersson

Cc stable@ is used to assist in making sure your patch is backported to stable kernels, other than that the purpose Cc here is to indicate that specific people have been requested to comment on your patch.

So please skip these from the commit message in the future

Thanks for informing me of this, I've re-read the patch submission documentation and will omit the Cc's in the future from the commit message (other than Cc stable@).

Regards,

Chris.

maintainer Applied
#3 lore raw
In reply to Chris Goldsworthy
Quoted 13 lines · Chris Goldsworthy

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")

To: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Quoted 4 lines
---
 drivers/of/of_reserved_mem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Applied, thanks.

Rob