mirror of
https://github.com/torvalds/linux.git
synced 2024-12-05 10:32:35 +00:00
iavf: Fix error handling in iavf_init_module()
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 commitf276e00279
("usb: u132-hcd: fix resource leak") Fixes:2803b16c10
("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>
This commit is contained in:
parent
771a794c0a
commit
227d8d2f7f
@ -5196,6 +5196,8 @@ static struct pci_driver iavf_driver = {
|
||||
**/
|
||||
static int __init iavf_init_module(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
pr_info("iavf: %s\n", iavf_driver_string);
|
||||
|
||||
pr_info("%s\n", iavf_copyright);
|
||||
@ -5206,7 +5208,12 @@ static int __init iavf_init_module(void)
|
||||
pr_err("%s: Failed to create workqueue\n", iavf_driver_name);
|
||||
return -ENOMEM;
|
||||
}
|
||||
return pci_register_driver(&iavf_driver);
|
||||
|
||||
ret = pci_register_driver(&iavf_driver);
|
||||
if (ret)
|
||||
destroy_workqueue(iavf_wq);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
module_init(iavf_init_module);
|
||||
|
Loading…
Reference in New Issue
Block a user