diff mbox series

[-next] net: dsa: rzn1-a5psw: add missing of_node_put() in a5psw_pcs_get()

Message ID 20220629092435.496051-1-yangyingliang@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [-next] net: dsa: rzn1-a5psw: add missing of_node_put() in a5psw_pcs_get() | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 5 maintainers not CCed: vivien.didelot@gmail.com pabeni@redhat.com kuba@kernel.org edumazet@google.com andrew@lunn.ch
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yang Yingliang June 29, 2022, 9:24 a.m. UTC
of_parse_phandle() will increase the refcount of 'pcs_node', so add
of_node_put() before return from a5psw_pcs_get().

Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/net/dsa/rzn1_a5psw.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Clément Léger June 29, 2022, 9:49 a.m. UTC | #1
Le Wed, 29 Jun 2022 17:24:35 +0800,
Yang Yingliang <yangyingliang@huawei.com> a écrit :

> of_parse_phandle() will increase the refcount of 'pcs_node', so add
> of_node_put() before return from a5psw_pcs_get().
> 
> Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/net/dsa/rzn1_a5psw.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index 3e910da98ae2..301171ee1061 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -923,6 +923,7 @@ static int a5psw_pcs_get(struct a5psw *a5psw)
>  	return 0;
>  
>  free_pcs:
> +	of_node_put(pcs_node);

of_node_put(pcs_node) should probably also be called after
miic_create(a5psw->dev, pcs_node); since it is not needed anymore.

Clément

>  	of_node_put(port);
>  	of_node_put(ports);
>  	a5psw_pcs_free(a5psw);
diff mbox series

Patch

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 3e910da98ae2..301171ee1061 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -923,6 +923,7 @@  static int a5psw_pcs_get(struct a5psw *a5psw)
 	return 0;
 
 free_pcs:
+	of_node_put(pcs_node);
 	of_node_put(port);
 	of_node_put(ports);
 	a5psw_pcs_free(a5psw);