diff mbox series

net: dsa: Add missing of_node_put() in dsa_port_parse_of

Message ID 20220316082602.10785-1-linmq006@gmail.com (mailing list archive)
State Accepted
Commit cb0b430b4e3acc88c85e0ad2e25f2a25a5765262
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: Add missing of_node_put() in dsa_port_parse_of | expand

Checks

Context Check Description
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 success CCed 7 of 7 maintainers
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/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
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Miaoqian Lin March 16, 2022, 8:26 a.m. UTC
The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

Fixes: 6d4e5c570c2d ("net: dsa: get port type at parse time")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 net/dsa/dsa2.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Paolo Abeni March 17, 2022, 12:12 p.m. UTC | #1
On Wed, 2022-03-16 at 08:26 +0000, Miaoqian Lin wrote:
> The device_node pointer is returned by of_parse_phandle()  with refcount
> incremented. We should use of_node_put() on it when done.
> 
> Fixes: 6d4e5c570c2d ("net: dsa: get port type at parse time")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

LGTM, thanks! 

For the records, it looks like there is a similar issue in
net/dsa/port.c: dsa_port_link_register_of().

Thanks!

Paolo
patchwork-bot+netdevbpf@kernel.org March 17, 2022, 12:40 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Wed, 16 Mar 2022 08:26:02 +0000 you wrote:
> The device_node pointer is returned by of_parse_phandle()  with refcount
> incremented. We should use of_node_put() on it when done.
> 
> Fixes: 6d4e5c570c2d ("net: dsa: get port type at parse time")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  net/dsa/dsa2.c | 1 +
>  1 file changed, 1 insertion(+)

Here is the summary with links:
  - net: dsa: Add missing of_node_put() in dsa_port_parse_of
    https://git.kernel.org/netdev/net/c/cb0b430b4e3a

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index b4e67758e104..1574f001725c 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -1436,6 +1436,7 @@  static int dsa_port_parse_of(struct dsa_port *dp, struct device_node *dn)
 		const char *user_protocol;
 
 		master = of_find_net_device_by_node(ethernet);
+		of_node_put(ethernet);
 		if (!master)
 			return -EPROBE_DEFER;