linux/drivers/infiniband/hw/hns
Yangyang Li 8b436a99cd RDMA/hns: Fix the double unlock problem of poll_sem
If hns_roce_cmd_use_events() fails then it means that the poll_sem is not
obtained, but the poll_sem is released in hns_roce_cmd_use_polling(), this
will cause an unlock problem.

This is the static checker warning:
	drivers/infiniband/hw/hns/hns_roce_main.c:926 hns_roce_init()
	error: double unlocked '&hr_dev->cmd.poll_sem' (orig line 879)

Event mode and polling mode are mutually exclusive and resources are
separated, so there is no need to process polling mode resources in event
mode.

The initial mode of cmd is polling mode, so even if cmd fails to switch to
event mode, it is not necessary to switch to polling mode.

Fixes: a389d016c0 ("RDMA/hns: Enable all CMDQ context")
Fixes: 3d50503b3b ("RDMA/hns: Optimize cmd init and mode selection for hip08")
Link: https://lore.kernel.org/r/1627887374-20019-1-git-send-email-liangwenpeng@huawei.com
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2021-08-03 13:42:44 -03:00
..
hns_roce_ah.c RDMA/hns: Avoid filling sl in high 3 bits of vlan_id 2020-12-11 15:21:34 -04:00
hns_roce_alloc.c RDMA/hns: Use IDA interface to manage xrcd index 2021-06-21 15:42:54 -03:00
hns_roce_cmd.c RDMA/hns: Fix the double unlock problem of poll_sem 2021-08-03 13:42:44 -03:00
hns_roce_cmd.h RDMA/hns: Fix incorrect symbol types 2020-12-11 15:21:35 -04:00
hns_roce_common.h RDMA/hns: Add hr_reg_write_bool() 2021-06-21 15:03:41 -03:00
hns_roce_cq.c RDMA/hns: Use refcount_t instead of atomic_t for CQ reference counting 2021-06-08 14:56:11 -03:00
hns_roce_db.c RDMA/hns: Remove unused parameter udata 2021-05-20 11:52:16 -03:00
hns_roce_device.h RDMA/hns: Fix spelling mistakes of original 2021-06-22 15:17:08 -03:00
hns_roce_hem.c RDMA: Fix kernel-doc warnings about wrong comment 2021-06-21 20:32:50 -03:00
hns_roce_hem.h RDMA/hns: Clean the hardware related code for HEM 2021-05-28 20:13:58 -03:00
hns_roce_hw_v1.c RDMA/hns: Use IDA interface to manage mtpt index 2021-06-21 15:42:53 -03:00
hns_roce_hw_v1.h RDMA/hns: Clean the hardware related code for HEM 2021-05-28 20:13:58 -03:00
hns_roce_hw_v2_dfx.c RDMA/hns: Dump detailed driver-specific CQ 2019-04-08 13:05:25 -03:00
hns_roce_hw_v2.c RDMA/hns: Add window selection field of congestion control 2021-06-24 15:14:06 -03:00
hns_roce_hw_v2.h RDMA/hns: Add window selection field of congestion control 2021-06-24 15:14:06 -03:00
hns_roce_main.c RDMA/hns: Fix the double unlock problem of poll_sem 2021-08-03 13:42:44 -03:00
hns_roce_mr.c RDMA/hns: Fix some print issues 2021-06-22 15:17:06 -03:00
hns_roce_pd.c RDMA/hns: Use IDA interface to manage xrcd index 2021-06-21 15:42:54 -03:00
hns_roce_qp.c RDMA/hns: Encapsulate flushing CQE as a function 2021-06-22 15:17:07 -03:00
hns_roce_restrack.c RDMA: Add a dedicated CQ resource tracker function 2020-06-23 11:46:27 -03:00
hns_roce_srq.c RDMA/hns: Remove unused RR mechanism 2021-06-21 15:42:53 -03:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile RDMA/hns: Fix build error again 2019-10-29 16:16:54 -03:00