diff mbox series

amd-xgbe: Fix error path in xgbe_mod_init()

Message ID 20190829024600.16052-1-yuehaibing@huawei.com
State Accepted
Delegated to: David Miller
Headers show
Series amd-xgbe: Fix error path in xgbe_mod_init() | expand

Commit Message

Yue Haibing Aug. 29, 2019, 2:46 a.m. UTC
In xgbe_mod_init(), we should do cleanup if some error occurs

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: efbaa828330a ("amd-xgbe: Add support to handle device renaming")
Fixes: 47f164deab22 ("amd-xgbe: Add PCI device support")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Jakub Kicinski Aug. 29, 2019, 5:52 p.m. UTC | #1
On Thu, 29 Aug 2019 10:46:00 +0800, YueHaibing wrote:
> In xgbe_mod_init(), we should do cleanup if some error occurs
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: efbaa828330a ("amd-xgbe: Add support to handle device renaming")
> Fixes: 47f164deab22 ("amd-xgbe: Add PCI device support")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Looks correct.

For networking fixes please try to use [PATCH net] as a tag ([PATCH
net-next] for normal, non-fix patches).
Yue Haibing Aug. 30, 2019, 1:40 a.m. UTC | #2
On 2019/8/30 1:52, Jakub Kicinski wrote:
> On Thu, 29 Aug 2019 10:46:00 +0800, YueHaibing wrote:
>> In xgbe_mod_init(), we should do cleanup if some error occurs
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Fixes: efbaa828330a ("amd-xgbe: Add support to handle device renaming")
>> Fixes: 47f164deab22 ("amd-xgbe: Add PCI device support")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> 
> Looks correct.

Thanks!
> 
> For networking fixes please try to use [PATCH net] as a tag ([PATCH
> net-next] for normal, non-fix patches).

Ok.
> 
>
David Miller Aug. 30, 2019, 9:15 p.m. UTC | #3
From: YueHaibing <yuehaibing@huawei.com>
Date: Thu, 29 Aug 2019 10:46:00 +0800

> In xgbe_mod_init(), we should do cleanup if some error occurs
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: efbaa828330a ("amd-xgbe: Add support to handle device renaming")
> Fixes: 47f164deab22 ("amd-xgbe: Add PCI device support")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Applied.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
index b41f236..7ce9c69 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
@@ -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)