RDMA/hns: Fix unnecessary port_num transition in HW stats allocation
authorJunxian Huang <huangjunxian6@hisilicon.com>
Tue, 17 Oct 2023 12:52:38 +0000 (20:52 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:59:21 +0000 (11:59 +0100)
commit1210137c7f82beb0dd7506a4befb05753c0979b7
tree62cca2ed07818e6ac9f4aabea679f6f6f945acd1
parentceb48ed1677f7322e9d75d037633f8474bf26ce7
RDMA/hns: Fix unnecessary port_num transition in HW stats allocation

[ Upstream commit b4a797b894dc91a541ea230db6fa00cc74683bfd ]

The num_ports capability of devices should be compared with the
number of port(i.e. the input param "port_num") but not the port
index(i.e. port_num - 1).

Fixes: 5a87279591a1 ("RDMA/hns: Support hns HW stats")
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://lore.kernel.org/r/20231017125239.164455-7-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/hns/hns_roce_main.c