All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: ti: omap-usb2: Fix refcount leak in omap_usb2_probe
@ 2022-05-12  4:32 ` Miaoqian Lin
  0 siblings, 0 replies; 4+ messages in thread
From: Miaoqian Lin @ 2022-05-12  4:32 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul, Miaoqian Lin, Liam Beguin,
	Greg Kroah-Hartman, Roger Quadros, linux-phy, linux-kernel

of_parse_phandle() 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: 478b6c7436c2 ("usb: phy: omap-usb2: Don't use omap_get_control_dev()")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/phy/ti/phy-omap-usb2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
index 31a775877f6e..98133e5fc9de 100644
--- a/drivers/phy/ti/phy-omap-usb2.c
+++ b/drivers/phy/ti/phy-omap-usb2.c
@@ -421,6 +421,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
 		}
 
 		control_pdev = of_find_device_by_node(control_node);
+		of_node_put(control_node);
 		if (!control_pdev) {
 			dev_err(&pdev->dev, "Failed to get control device\n");
 			return -EINVAL;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] phy: ti: omap-usb2: Fix refcount leak in omap_usb2_probe
@ 2022-05-12  4:32 ` Miaoqian Lin
  0 siblings, 0 replies; 4+ messages in thread
From: Miaoqian Lin @ 2022-05-12  4:32 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul, Miaoqian Lin, Liam Beguin,
	Greg Kroah-Hartman, Roger Quadros, linux-phy, linux-kernel

of_parse_phandle() 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: 478b6c7436c2 ("usb: phy: omap-usb2: Don't use omap_get_control_dev()")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/phy/ti/phy-omap-usb2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
index 31a775877f6e..98133e5fc9de 100644
--- a/drivers/phy/ti/phy-omap-usb2.c
+++ b/drivers/phy/ti/phy-omap-usb2.c
@@ -421,6 +421,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
 		}
 
 		control_pdev = of_find_device_by_node(control_node);
+		of_node_put(control_node);
 		if (!control_pdev) {
 			dev_err(&pdev->dev, "Failed to get control device\n");
 			return -EINVAL;
-- 
2.25.1


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] phy: ti: omap-usb2: Fix refcount leak in omap_usb2_probe
  2022-05-12  4:32 ` Miaoqian Lin
@ 2022-05-12 14:41   ` Liam Beguin
  -1 siblings, 0 replies; 4+ messages in thread
From: Liam Beguin @ 2022-05-12 14:41 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Kishon Vijay Abraham I, Vinod Koul, Greg Kroah-Hartman,
	Roger Quadros, linux-phy, linux-kernel

On Thu, May 12, 2022 at 08:32:33AM +0400, Miaoqian Lin wrote:
> of_parse_phandle() 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: 478b6c7436c2 ("usb: phy: omap-usb2: Don't use omap_get_control_dev()")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/phy/ti/phy-omap-usb2.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
> index 31a775877f6e..98133e5fc9de 100644
> --- a/drivers/phy/ti/phy-omap-usb2.c
> +++ b/drivers/phy/ti/phy-omap-usb2.c
> @@ -421,6 +421,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  		}
>  
>  		control_pdev = of_find_device_by_node(control_node);
> +		of_node_put(control_node);
>  		if (!control_pdev) {
>  			dev_err(&pdev->dev, "Failed to get control device\n");
>  			return -EINVAL;
> -- 
> 2.25.1
> 

Reviewed-by: Liam Beguin <liambeguin@gmail.com>

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] phy: ti: omap-usb2: Fix refcount leak in omap_usb2_probe
@ 2022-05-12 14:41   ` Liam Beguin
  0 siblings, 0 replies; 4+ messages in thread
From: Liam Beguin @ 2022-05-12 14:41 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Kishon Vijay Abraham I, Vinod Koul, Greg Kroah-Hartman,
	Roger Quadros, linux-phy, linux-kernel

On Thu, May 12, 2022 at 08:32:33AM +0400, Miaoqian Lin wrote:
> of_parse_phandle() 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: 478b6c7436c2 ("usb: phy: omap-usb2: Don't use omap_get_control_dev()")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/phy/ti/phy-omap-usb2.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
> index 31a775877f6e..98133e5fc9de 100644
> --- a/drivers/phy/ti/phy-omap-usb2.c
> +++ b/drivers/phy/ti/phy-omap-usb2.c
> @@ -421,6 +421,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  		}
>  
>  		control_pdev = of_find_device_by_node(control_node);
> +		of_node_put(control_node);
>  		if (!control_pdev) {
>  			dev_err(&pdev->dev, "Failed to get control device\n");
>  			return -EINVAL;
> -- 
> 2.25.1
> 

Reviewed-by: Liam Beguin <liambeguin@gmail.com>

Thanks!

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-12 14:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  4:32 [PATCH] phy: ti: omap-usb2: Fix refcount leak in omap_usb2_probe Miaoqian Lin
2022-05-12  4:32 ` Miaoqian Lin
2022-05-12 14:41 ` Liam Beguin
2022-05-12 14:41   ` Liam Beguin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.