Skip to contentSkip to conversation

usb: host: Fix refcount leak in ehci_hcd_ppc_of_probe

PATCH In review Miaoqian Lin 2 participants 2 messages Jun 2, 2022

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

PATCH 1/1 usb: host: Fix refcount leak in ehci_hcd_ppc_of_probe

of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.

Fixes 796bcae7361c ("USB: powerpc: Workaround for the PPC440EPX USBH_23 errata [take 3]")
---
 drivers/usb/host/ehci-ppc-of.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ehci-ppc-of.c +1 -0
index 6bbaee74f7e7..28a19693c19f 100644
@@ -148,6 +148,7 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op)
 		} else {
 			ehci->has_amcc_usb23 = 1;
 		}
+		of_node_put(np);
 	}
 
 	if (of_get_property(dn, "big-endian", NULL)) {
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Miaoqian Lin

of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.

Fixes 796bcae7361c ("USB: powerpc: Workaround for the PPC440EPX USBH_23 errata [take 3]")

---

Quoted 18 lines
 drivers/usb/host/ehci-ppc-of.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ehci-ppc-of.c +1 -0
index 6bbaee74f7e7..28a19693c19f 100644
@@ -148,6 +148,7 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op)
 		} else {
 			ehci->has_amcc_usb23 = 1;
 		}
+		of_node_put(np);
 	}
 
 	if (of_get_property(dn, "big-endian", NULL)) {
Signature · 1 line
2.25.1