Skip to content

Commit 0bf9207

Browse files
committed
Merge branch 'pci/workqueue'
- Add WQ_PERCPU to alloc_workqueue() users (Marco Crivellari) - Replace use of system_wq with system_percpu_wq (Marco Crivellari) - Check for failure of alloc_workqueue() to avoid NULL pointer dereferences (Haotian Zhang) * pci/workqueue: PCI: endpoint: Add missing NULL check for alloc_workqueue() PCI: endpoint: Replace use of system_wq with system_percpu_wq PCI: Add WQ_PERCPU to alloc_workqueue() users # Conflicts: # drivers/pci/endpoint/pci-ep-cfs.c
2 parents 2095b9d + 03f336a commit 0bf9207

6 files changed

Lines changed: 19 additions & 8 deletions

File tree

drivers/pci/endpoint/functions/pci-epf-mhi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ static int pci_epf_mhi_dma_init(struct pci_epf_mhi *epf_mhi)
686686
goto err_release_tx;
687687
}
688688

689-
epf_mhi->dma_wq = alloc_workqueue("pci_epf_mhi_dma_wq", 0, 0);
689+
epf_mhi->dma_wq = alloc_workqueue("pci_epf_mhi_dma_wq", WQ_PERCPU, 0);
690690
if (!epf_mhi->dma_wq) {
691691
ret = -ENOMEM;
692692
goto err_release_rx;

drivers/pci/endpoint/functions/pci-epf-ntb.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,8 +2124,13 @@ static int __init epf_ntb_init(void)
21242124
{
21252125
int ret;
21262126

2127-
kpcintb_workqueue = alloc_workqueue("kpcintb", WQ_MEM_RECLAIM |
2128-
WQ_HIGHPRI, 0);
2127+
kpcintb_workqueue = alloc_workqueue("kpcintb",
2128+
WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_PERCPU, 0);
2129+
if (!kpcintb_workqueue) {
2130+
pr_err("Failed to allocate kpcintb workqueue\n");
2131+
return -ENOMEM;
2132+
}
2133+
21292134
ret = pci_epf_register_driver(&epf_ntb_driver);
21302135
if (ret) {
21312136
destroy_workqueue(kpcintb_workqueue);

drivers/pci/endpoint/functions/pci-epf-test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ static int __init pci_epf_test_init(void)
11881188
int ret;
11891189

11901190
kpcitest_workqueue = alloc_workqueue("kpcitest",
1191-
WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
1191+
WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_PERCPU, 0);
11921192
if (!kpcitest_workqueue) {
11931193
pr_err("Failed to allocate the kpcitest work queue\n");
11941194
return -ENOMEM;

drivers/pci/endpoint/functions/pci-epf-vntb.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,8 +1651,13 @@ static int __init epf_ntb_init(void)
16511651
{
16521652
int ret;
16531653

1654-
kpcintb_workqueue = alloc_workqueue("kpcintb", WQ_MEM_RECLAIM |
1655-
WQ_HIGHPRI, 0);
1654+
kpcintb_workqueue = alloc_workqueue("kpcintb",
1655+
WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_PERCPU, 0);
1656+
if (!kpcintb_workqueue) {
1657+
pr_err("Failed to allocate kpcintb workqueue\n");
1658+
return -ENOMEM;
1659+
}
1660+
16561661
ret = pci_epf_register_driver(&epf_ntb_driver);
16571662
if (ret) {
16581663
destroy_workqueue(kpcintb_workqueue);

drivers/pci/hotplug/pnv_php.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ static struct pnv_php_slot *pnv_php_alloc_slot(struct device_node *dn)
802802
}
803803

804804
/* Allocate workqueue for this slot's interrupt handling */
805-
php_slot->wq = alloc_workqueue("pciehp-%s", 0, 0, php_slot->name);
805+
php_slot->wq = alloc_workqueue("pciehp-%s", WQ_PERCPU, 0, php_slot->name);
806806
if (!php_slot->wq) {
807807
SLOT_WARN(php_slot, "Cannot alloc workqueue\n");
808808
kfree(php_slot->name);

drivers/pci/hotplug/shpchp_core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ static int init_slots(struct controller *ctrl)
8080
slot->device = ctrl->slot_device_offset + i;
8181
slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i);
8282

83-
slot->wq = alloc_workqueue("shpchp-%d", 0, 0, slot->number);
83+
slot->wq = alloc_workqueue("shpchp-%d", WQ_PERCPU, 0,
84+
slot->number);
8485
if (!slot->wq) {
8586
retval = -ENOMEM;
8687
goto error_slot;

0 commit comments

Comments
 (0)