diff mbox series

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

Message ID 20220617034637.4003115-1-windhl@126.com (mailing list archive)
State Accepted
Commit 40a959d7042bb7711e404ad2318b30e9f92c6b9b
Headers show
Series usb: host: ohci-ppc-of: Fix refcount leak bug | expand

Commit Message

Liang He June 17, 2022, 3:46 a.m. UTC
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.

Signed-off-by: Liang He <windhl@126.com>
---
 drivers/usb/host/ohci-ppc-of.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Alan Stern June 17, 2022, 3:15 p.m. UTC | #1
On Fri, Jun 17, 2022 at 11:46:37AM +0800, Liang He wrote:
> 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.
> 
> Signed-off-by: Liang He <windhl@126.com>
> ---

Acked-by: Alan Stern <stern@rowland.harvard.edu>

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

>  drivers/usb/host/ohci-ppc-of.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
> index 1960b8dfdba5..591f675cc930 100644
> --- a/drivers/usb/host/ohci-ppc-of.c
> +++ b/drivers/usb/host/ohci-ppc-of.c
> @@ -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);
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index 1960b8dfdba5..591f675cc930 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -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);