iavf: Fix error handling in iavf_init_module()
authorYuan Can <yuancan@huawei.com>
Mon, 14 Nov 2022 08:26:40 +0000 (08:26 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Dec 2022 10:28:39 +0000 (11:28 +0100)
commit0d9f5bd54b913018031c5b964fc1f9a31f5f6cb5
tree8c093f3958f5128e3edccb0a1adef9791c1c0d90
parentb0b2b9050c1765dd606aaee35e15392d0f61ba2b
iavf: Fix error handling in iavf_init_module()

[ Upstream commit 227d8d2f7f2278b8468c5531b0cd0f2a905b4486 ]

The iavf_init_module() won't destroy workqueue when pci_register_driver()
failed. Call destroy_workqueue() when pci_register_driver() failed to
prevent the resource leak.

Similar to the handling of u132_hcd_init in commit f276e002793c
("usb: u132-hcd: fix resource leak")

Fixes: 2803b16c10ea ("i40e/i40evf: Use private workqueue")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/iavf/iavf_main.c