]> git.baikalelectronics.ru Git - kernel.git/commitdiff
amd-xgbe: Fix error path in xgbe_mod_init()
authorYueHaibing <yuehaibing@huawei.com>
Thu, 29 Aug 2019 02:46:00 +0000 (10:46 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 30 Aug 2019 21:15:31 +0000 (14:15 -0700)
In xgbe_mod_init(), we should do cleanup if some error occurs

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: e15064bb4cc1 ("amd-xgbe: Add support to handle device renaming")
Fixes: 5cd474a27ba1 ("amd-xgbe: Add PCI device support")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amd/xgbe/xgbe-main.c

index b41f23679a087b2a49676ae362044c1b8085820a..7ce9c69e9c44f3d4288d04f710b96222ebf2fb77 100644 (file)
@@ -469,13 +469,19 @@ static int __init xgbe_mod_init(void)
 
        ret = xgbe_platform_init();
        if (ret)
-               return ret;
+               goto err_platform_init;
 
        ret = xgbe_pci_init();
        if (ret)
-               return ret;
+               goto err_pci_init;
 
        return 0;
+
+err_pci_init:
+       xgbe_platform_exit();
+err_platform_init:
+       unregister_netdevice_notifier(&xgbe_netdev_notifier);
+       return ret;
 }
 
 static void __exit xgbe_mod_exit(void)