From: Hangyu Hua Date: Mon, 21 Feb 2022 08:55:52 +0000 (+0800) Subject: staging: qlge: add unregister_netdev in qlge_probe X-Git-Tag: v6.1-rc5~1691^2~136 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4fcc0c275e3f59cd68f977c57953783f8014ed15;p=platform%2Fkernel%2Flinux-starfive.git staging: qlge: add unregister_netdev in qlge_probe unregister_netdev need to be called when register_netdev succeeds qlge_health_create_reporters fails. Fixes: d8827ae8e22b ("staging: qlge: deal with the case that devlink_health_reporter_create fails") Signed-off-by: Hangyu Hua Link: https://lore.kernel.org/r/20220221085552.93561-1-hbh25y@gmail.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 9873bb2..113a3ef 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -4605,14 +4605,12 @@ static int qlge_probe(struct pci_dev *pdev, err = register_netdev(ndev); if (err) { dev_err(&pdev->dev, "net device registration failed.\n"); - qlge_release_all(pdev); - pci_disable_device(pdev); - goto netdev_free; + goto cleanup_pdev; } err = qlge_health_create_reporters(qdev); if (err) - goto netdev_free; + goto unregister_netdev; /* Start up the timer to trigger EEH if * the bus goes dead @@ -4626,6 +4624,11 @@ static int qlge_probe(struct pci_dev *pdev, devlink_register(devlink); return 0; +unregister_netdev: + unregister_netdev(ndev); +cleanup_pdev: + qlge_release_all(pdev); + pci_disable_device(pdev); netdev_free: free_netdev(ndev); devlink_free: