Skip to content

Commit 7fac716

Browse files
Wenpeng Liangjgunthorpe
authored andcommitted
RDMA/hns: Adjust the order in which irq are requested and enabled
It should first alloc workqueue and request irq, and finally enable irq. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wenpeng Liang <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent ab5cbb9 commit 7fac716

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6114,35 +6114,32 @@ static int hns_roce_v2_init_eq_table(struct hns_roce_dev *hr_dev)
61146114

61156115
ret = hns_roce_v2_create_eq(hr_dev, eq, eq_cmd);
61166116
if (ret) {
6117-
dev_err(dev, "eq create failed.\n");
6117+
dev_err(dev, "failed to create eq.\n");
61186118
goto err_create_eq_fail;
61196119
}
61206120
}
61216121

6122-
/* enable irq */
6123-
hns_roce_v2_int_mask_enable(hr_dev, eq_num, EQ_ENABLE);
6122+
hr_dev->irq_workq = alloc_ordered_workqueue("hns_roce_irq_workq", 0);
6123+
if (!hr_dev->irq_workq) {
6124+
dev_err(dev, "failed to create irq workqueue.\n");
6125+
ret = -ENOMEM;
6126+
goto err_create_eq_fail;
6127+
}
61246128

6125-
ret = __hns_roce_request_irq(hr_dev, irq_num, comp_num,
6126-
aeq_num, other_num);
6129+
ret = __hns_roce_request_irq(hr_dev, irq_num, comp_num, aeq_num,
6130+
other_num);
61276131
if (ret) {
6128-
dev_err(dev, "Request irq failed.\n");
6132+
dev_err(dev, "failed to request irq.\n");
61296133
goto err_request_irq_fail;
61306134
}
61316135

6132-
hr_dev->irq_workq = alloc_ordered_workqueue("hns_roce_irq_workq", 0);
6133-
if (!hr_dev->irq_workq) {
6134-
dev_err(dev, "Create irq workqueue failed!\n");
6135-
ret = -ENOMEM;
6136-
goto err_create_wq_fail;
6137-
}
6136+
/* enable irq */
6137+
hns_roce_v2_int_mask_enable(hr_dev, eq_num, EQ_ENABLE);
61386138

61396139
return 0;
61406140

6141-
err_create_wq_fail:
6142-
__hns_roce_free_irq(hr_dev);
6143-
61446141
err_request_irq_fail:
6145-
hns_roce_v2_int_mask_enable(hr_dev, eq_num, EQ_DISABLE);
6142+
destroy_workqueue(hr_dev->irq_workq);
61466143

61476144
err_create_eq_fail:
61486145
for (i -= 1; i >= 0; i--)

0 commit comments

Comments
 (0)