Skip to contentSkip to conversation

bus: qcom: Put child node before return

PATCH Applied Pan Bian 4 participants 5 messages Jan 21, 2021 – Mar 11, 2021

Subsystems (2)
lore
Share & tools
lore

Pan Bian

author
#0 lore raw

PATCH 1/1 bus: qcom: Put child node before return

Put child node before return to fix potential reference count leak. Generally, the reference count of child is incremented and decremented automatically in the macro for_each_available_child_of_node() and should be decremented manually if the loop is broken in loop body.

Fixes 335a12754808 ("bus: qcom: add EBI2 driver")
---
 drivers/bus/qcom-ebi2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bus/qcom-ebi2.c +3 -1
index 03ddcf426887..0b8f53a688b8 100644
@@ -353,8 +353,10 @@ static int qcom_ebi2_probe(struct platform_device *pdev)
 
 		/* Figure out the chipselect */
 		ret = of_property_read_u32(child, "reg", &csindex);
-		if (ret)
+		if (ret) {
+			of_node_put(child);
 			return ret;
+		}
 
 		if (csindex > 5) {
 			dev_err(dev,
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Pan Bian

Put child node before return to fix potential reference count leak. Generally, the reference count of child is incremented and decremented automatically in the macro for_each_available_child_of_node() and should be decremented manually if the loop is broken in loop body.

Fixes 335a12754808 ("bus: qcom: add EBI2 driver")

Please submit this patch for inclusion through the ARM SoC tree.

Yours,
Linus Walleij

#2 lore raw
Quoted 7 lines · Linus Walleij
Quoted 5 lines · Pan Bian

Put child node before return to fix potential reference count leak. Generally, the reference count of child is incremented and decremented automatically in the macro for_each_available_child_of_node() and should be decremented manually if the loop is broken in loop body.

Quoted 7 lines
Quoted 2 lines
Fixes 335a12754808 ("bus: qcom: add EBI2 driver")

Please submit this patch for inclusion through the ARM SoC tree.

Any objections to me picking it in the Qualcomm tree? Or that's what you indirectly meant?

Regards,
Bjorn

#3 lore raw
Quoted 12 lines · Bjorn Andersson
Quoted 10 lines · Linus Walleij
Quoted 7 lines · Pan Bian

Put child node before return to fix potential reference count leak. Generally, the reference count of child is incremented and decremented automatically in the macro for_each_available_child_of_node() and should be decremented manually if the loop is broken in loop body.

Fixes 335a12754808 ("bus: qcom: add EBI2 driver")
Quoted 7 lines
Quoted 4 lines

Please submit this patch for inclusion through the ARM SoC tree.

Any objections to me picking it in the Qualcomm tree? Or that's what you indirectly meant?

Kind-of-sort-of :D

Apply it to the Qualcomm tree!

Yours,
Linus Walleij

#4 lore raw
In reply to Pan Bian
This patch was applied to qcom/linux.git (refs/heads/for-next):

Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

Quoted 9 lines · On Thu, 21 Jan 2021 03:49:07 -0800 you wrote:

Put child node before return to fix potential reference count leak. Generally, the reference count of child is incremented and decremented automatically in the macro for_each_available_child_of_node() and should be decremented manually if the loop is broken in loop body.

Fixes 335a12754808 ("bus: qcom: add EBI2 driver")

[...]

Here is the summary with links:
- bus: qcom: Put child node before return

    https://git.kernel.org/qcom/c/4f26f0c36fe2

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html