diff mbox series

mips: ralink: fix a refcount leak in ill_acc_of_setup()

Message ID 20220228073537.31621-1-hbh25y@gmail.com (mailing list archive)
State Accepted
Commit 4a0a1436053b17e50b7c88858fb0824326641793
Headers show
Series mips: ralink: fix a refcount leak in ill_acc_of_setup() | expand

Commit Message

Hangyu Hua Feb. 28, 2022, 7:35 a.m. UTC
of_node_put(np) needs to be called when pdev == NULL.

Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
 arch/mips/ralink/ill_acc.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Thomas Bogendoerfer March 1, 2022, 4:29 p.m. UTC | #1
On Mon, Feb 28, 2022 at 03:35:37PM +0800, Hangyu Hua wrote:
> of_node_put(np) needs to be called when pdev == NULL.
> 
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> ---
>  arch/mips/ralink/ill_acc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/mips/ralink/ill_acc.c b/arch/mips/ralink/ill_acc.c
> index 115a69fc20ca..f395ae218470 100644
> --- a/arch/mips/ralink/ill_acc.c
> +++ b/arch/mips/ralink/ill_acc.c
> @@ -61,6 +61,7 @@ static int __init ill_acc_of_setup(void)
>  	pdev = of_find_device_by_node(np);
>  	if (!pdev) {
>  		pr_err("%pOFn: failed to lookup pdev\n", np);
> +		of_node_put(np);
>  		return -EINVAL;
>  	}
>  
> -- 
> 2.25.1

applied to mips-next.

Thomas.
diff mbox series

Patch

diff --git a/arch/mips/ralink/ill_acc.c b/arch/mips/ralink/ill_acc.c
index 115a69fc20ca..f395ae218470 100644
--- a/arch/mips/ralink/ill_acc.c
+++ b/arch/mips/ralink/ill_acc.c
@@ -61,6 +61,7 @@  static int __init ill_acc_of_setup(void)
 	pdev = of_find_device_by_node(np);
 	if (!pdev) {
 		pr_err("%pOFn: failed to lookup pdev\n", np);
+		of_node_put(np);
 		return -EINVAL;
 	}