[net] net: marvell: prestera: add missing unregister_netdev() in prestera_port_create()

Message ID 1669115432-36841-1-git-send-email-zhangchangzhong@huawei.com
State New
Headers
Series [net] net: marvell: prestera: add missing unregister_netdev() in prestera_port_create() |

Commit Message

Zhang Changzhong Nov. 22, 2022, 11:10 a.m. UTC
  If prestera_port_sfp_bind() fails, unregister_netdev() should be called
in error handling path.

Compile tested only.

Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support")
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
---
 drivers/net/ethernet/marvell/prestera/prestera_main.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Maciej Fijalkowski Nov. 22, 2022, 12:27 p.m. UTC | #1
On Tue, Nov 22, 2022 at 07:10:31PM +0800, Zhang Changzhong wrote:
> If prestera_port_sfp_bind() fails, unregister_netdev() should be called
> in error handling path.
> 
> Compile tested only.
> 
> Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support")
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>

Makes sense and fixes commit is correct.
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

> ---
>  drivers/net/ethernet/marvell/prestera/prestera_main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
> index 24f9d60..47796e4 100644
> --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
> +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
> @@ -746,6 +746,7 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id)
>  	return 0;
>  
>  err_sfp_bind:
> +	unregister_netdev(dev);
>  err_register_netdev:
>  	prestera_port_list_del(port);
>  err_port_init:
> -- 
> 2.9.5
>
  
patchwork-bot+netdevbpf@kernel.org Nov. 24, 2022, 4:20 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 22 Nov 2022 19:10:31 +0800 you wrote:
> If prestera_port_sfp_bind() fails, unregister_netdev() should be called
> in error handling path.
> 
> Compile tested only.
> 
> Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support")
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
> 
> [...]

Here is the summary with links:
  - [net] net: marvell: prestera: add missing unregister_netdev() in prestera_port_create()
    https://git.kernel.org/netdev/net/c/9a234a2a085a

You are awesome, thank you!
  

Patch

diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
index 24f9d60..47796e4 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
@@ -746,6 +746,7 @@  static int prestera_port_create(struct prestera_switch *sw, u32 id)
 	return 0;
 
 err_sfp_bind:
+	unregister_netdev(dev);
 err_register_netdev:
 	prestera_port_list_del(port);
 err_port_init: