Skip to contentSkip to conversation

mips: ralink: fix a refcount leak in ill_acc_of_setup()

PATCH Applied Hangyu Hua 2 participants 2 messages Feb 28, 2022 – Mar 1, 2022

Subsystems (2)
lore
Share & tools
lore

Hangyu Hua

author
#0 lore raw

PATCH 1/1 mips: ralink: fix a refcount leak in ill_acc_of_setup()

of_node_put(np) needs to be called when pdev == NULL.

---
 arch/mips/ralink/ill_acc.c | 1 +
 1 file changed, 1 insertion(+)
arch/mips/ralink/ill_acc.c +1 -0
index 115a69fc20ca..f395ae218470 100644
@@ -61,6 +61,7 @@ static int __init ill_acc_of_setup(void)
 	pdev = of_find_device_by_node(np);
 	if (!pdev) {
 		pr_err("%pOFn: failed to lookup pdev\n", np);
+		of_node_put(np);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 21 lines · Hangyu Hua

of_node_put(np) needs to be called when pdev == NULL.

---
 arch/mips/ralink/ill_acc.c | 1 +
 1 file changed, 1 insertion(+)
arch/mips/ralink/ill_acc.c +1 -0
index 115a69fc20ca..f395ae218470 100644
@@ -61,6 +61,7 @@ static int __init ill_acc_of_setup(void)
 	pdev = of_find_device_by_node(np);
 	if (!pdev) {
 		pr_err("%pOFn: failed to lookup pdev\n", np);
+		of_node_put(np);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.25.1

applied to mips-next.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]