Skip to contentSkip to conversation

usb: host: ohci-ppc-of: Fix refcount leak bug

PATCH In review Liang He 2 participants 2 messages Jun 17, 2022

Subsystems (2)
lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 usb: host: ohci-ppc-of: Fix refcount leak bug

In ohci_hcd_ppc_of_probe(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.

---
 drivers/usb/host/ohci-ppc-of.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-ppc-of.c +1 -0
index 1960b8dfdba5..591f675cc930 100644
@@ -166,6 +166,7 @@ static int ohci_hcd_ppc_of_probe(struct platform_device *op)
 				release_mem_region(res.start, 0x4);
 		} else
 			pr_debug("%s: cannot get ehci offset from fdt\n", __FILE__);
+		of_node_put(np);
 	}
 
 	irq_dispose_mapping(irq);
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Liang He

In ohci_hcd_ppc_of_probe(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.

---

This seems to be the last one; ehci-ppc-of.c was already fixed by an earlier patch.

Quoted 18 lines
 drivers/usb/host/ohci-ppc-of.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-ppc-of.c +1 -0
index 1960b8dfdba5..591f675cc930 100644
@@ -166,6 +166,7 @@ static int ohci_hcd_ppc_of_probe(struct platform_device *op)
 				release_mem_region(res.start, 0x4);
 		} else
 			pr_debug("%s: cannot get ehci offset from fdt\n", __FILE__);
+		of_node_put(np);
 	}
 
 	irq_dispose_mapping(irq);
Signature · 1 line
2.25.1