diff mbox series

net: dsa: Removed unneeded of_node_put in felix_parse_ports_node

Message ID 20230710031859.36784-1-luhongfei@vivo.com (mailing list archive)
State Accepted
Commit 04499f28b40bfc24f20b0e2331008bb90a54a6cf
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: Removed unneeded of_node_put in felix_parse_ports_node | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1341 this patch: 1341
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 1364 this patch: 1364
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1364 this patch: 1364
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

Lu Hongfei July 10, 2023, 3:18 a.m. UTC
Remove unnecessary of_node_put from the continue path to prevent
child node from being released twice, which could avoid resource
leak or other unexpected issues.

Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
---
 drivers/net/dsa/ocelot/felix.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Vladimir Oltean July 10, 2023, 10:58 a.m. UTC | #1
On Mon, Jul 10, 2023 at 11:18:59AM +0800, Lu Hongfei wrote:
> Remove unnecessary of_node_put from the continue path to prevent
> child node from being released twice, which could avoid resource
> leak or other unexpected issues.
> 
> Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
> ---
>  drivers/net/dsa/ocelot/felix.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
> index dee43caee19e..8da46d284e35 100644
> --- a/drivers/net/dsa/ocelot/felix.c
> +++ b/drivers/net/dsa/ocelot/felix.c
> @@ -1286,7 +1286,6 @@ static int felix_parse_ports_node(struct felix *felix,
>  		if (err < 0) {
>  			dev_info(dev, "Unsupported PHY mode %s on port %d\n",
>  				 phy_modes(phy_mode), port);
> -			of_node_put(child);
>  
>  			/* Leave port_phy_modes[port] = 0, which is also
>  			 * PHY_INTERFACE_MODE_NA. This will perform a
> -- 
> 2.39.0
>

Fixes: de879a016a94 ("net: dsa: felix: add functionality when not all ports are supported")
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
patchwork-bot+netdevbpf@kernel.org July 11, 2023, 9 a.m. UTC | #2
Hello:

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

On Mon, 10 Jul 2023 11:18:59 +0800 you wrote:
> Remove unnecessary of_node_put from the continue path to prevent
> child node from being released twice, which could avoid resource
> leak or other unexpected issues.
> 
> Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
> ---
>  drivers/net/dsa/ocelot/felix.c | 1 -
>  1 file changed, 1 deletion(-)

Here is the summary with links:
  - net: dsa: Removed unneeded of_node_put in felix_parse_ports_node
    https://git.kernel.org/netdev/net/c/04499f28b40b

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index dee43caee19e..8da46d284e35 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -1286,7 +1286,6 @@  static int felix_parse_ports_node(struct felix *felix,
 		if (err < 0) {
 			dev_info(dev, "Unsupported PHY mode %s on port %d\n",
 				 phy_modes(phy_mode), port);
-			of_node_put(child);
 
 			/* Leave port_phy_modes[port] = 0, which is also
 			 * PHY_INTERFACE_MODE_NA. This will perform a