net: marvell: prestera: add missing unregister_netdev() in prestera_port_create()
authorZhang Changzhong <zhangchangzhong@huawei.com>
Tue, 22 Nov 2022 11:10:31 +0000 (19:10 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 24 Nov 2022 04:12:43 +0000 (20:12 -0800)
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>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/r/1669115432-36841-1-git-send-email-zhangchangzhong@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/prestera/prestera_main.c

index 24f9d60247453107f79f425e1918928d27a92568..47796e4d900c631b3affd605ad7411eaeabf184c 100644 (file)
@@ -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: