Skip to content

Commit 8188a18

Browse files
jmberg-intellucacoelho
authored andcommitted
iwlwifi: pcie: fix rb_allocator workqueue allocation
We don't handle failures in the rb_allocator workqueue allocation correctly. To fix that, move the code earlier so the cleanup is easier and we don't have to undo all the interrupt allocations in this case. Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Luca Coelho <[email protected]>
1 parent 08326a9 commit 8188a18

File tree

1 file changed

+11
-4
lines changed
  • drivers/net/wireless/intel/iwlwifi/pcie

1 file changed

+11
-4
lines changed

drivers/net/wireless/intel/iwlwifi/pcie/trans.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3456,6 +3456,15 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
34563456
spin_lock_init(&trans_pcie->reg_lock);
34573457
mutex_init(&trans_pcie->mutex);
34583458
init_waitqueue_head(&trans_pcie->ucode_write_waitq);
3459+
3460+
trans_pcie->rba.alloc_wq = alloc_workqueue("rb_allocator",
3461+
WQ_HIGHPRI | WQ_UNBOUND, 1);
3462+
if (!trans_pcie->rba.alloc_wq) {
3463+
ret = -ENOMEM;
3464+
goto out_free_trans;
3465+
}
3466+
INIT_WORK(&trans_pcie->rba.rx_alloc, iwl_pcie_rx_allocator_work);
3467+
34593468
trans_pcie->tso_hdr_page = alloc_percpu(struct iwl_tso_hdr_page);
34603469
if (!trans_pcie->tso_hdr_page) {
34613470
ret = -ENOMEM;
@@ -3590,10 +3599,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
35903599
trans_pcie->inta_mask = CSR_INI_SET_MASK;
35913600
}
35923601

3593-
trans_pcie->rba.alloc_wq = alloc_workqueue("rb_allocator",
3594-
WQ_HIGHPRI | WQ_UNBOUND, 1);
3595-
INIT_WORK(&trans_pcie->rba.rx_alloc, iwl_pcie_rx_allocator_work);
3596-
35973602
#ifdef CONFIG_IWLWIFI_DEBUGFS
35983603
trans_pcie->fw_mon_data.state = IWL_FW_MON_DBGFS_STATE_CLOSED;
35993604
mutex_init(&trans_pcie->fw_mon_data.mutex);
@@ -3605,6 +3610,8 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
36053610
iwl_pcie_free_ict(trans);
36063611
out_no_pci:
36073612
free_percpu(trans_pcie->tso_hdr_page);
3613+
destroy_workqueue(trans_pcie->rba.alloc_wq);
3614+
out_free_trans:
36083615
iwl_trans_free(trans);
36093616
return ERR_PTR(ret);
36103617
}

0 commit comments

Comments
 (0)