usb: host: Fix refcount leak in ehci_hcd_ppc_of_probe
authorMiaoqian Lin <linmq006@gmail.com>
Thu, 2 Jun 2022 11:08:49 +0000 (15:08 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:11:21 +0000 (11:11 +0200)
[ Upstream commit b5c5b13cb45e2c88181308186b0001992cb41954 ]

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]")
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220602110849.58549-1-linmq006@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/host/ehci-ppc-of.c

index 1a10c8d542ca40c6b48e0fa349794ccb04f357aa..d36aa2c29d395122ee02e1b2a8a82a0d2bfff0f6 100644 (file)
@@ -147,6 +147,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)) {