diff options
author | weiyongjun (A) <weiyongjun1@huawei.com> | 2018-06-06 21:47:41 -0400 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-06-11 13:02:27 -0400 |
commit | e31abf76f4d4d3202ca16b9668b11178df23d473 (patch) | |
tree | 85d63b0103e44a17eae35f2d06c331d9b8d113c6 | |
parent | 299eafee39a22a9d9a7c19ae592b230bd199f259 (diff) |
IB/mlx5: Fix return value check in flow_counters_set_data()
In case of error, the function mlx5_fc_create() returns ERR_PTR() and
never returns NULL. The NULL test in the return value check should be
replaced with IS_ERR().
Fixes: 3b3233fbf02e ("IB/mlx5: Add flow counters binding support")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r-- | drivers/infiniband/hw/mlx5/main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index f93b30060ca7..645fc69997bc 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
@@ -3199,8 +3199,8 @@ static int flow_counters_set_data(struct ib_counters *ibcounters, | |||
3199 | if (!mcounters->hw_cntrs_hndl) { | 3199 | if (!mcounters->hw_cntrs_hndl) { |
3200 | mcounters->hw_cntrs_hndl = mlx5_fc_create( | 3200 | mcounters->hw_cntrs_hndl = mlx5_fc_create( |
3201 | to_mdev(ibcounters->device)->mdev, false); | 3201 | to_mdev(ibcounters->device)->mdev, false); |
3202 | if (!mcounters->hw_cntrs_hndl) { | 3202 | if (IS_ERR(mcounters->hw_cntrs_hndl)) { |
3203 | ret = -ENOMEM; | 3203 | ret = PTR_ERR(mcounters->hw_cntrs_hndl); |
3204 | goto free; | 3204 | goto free; |
3205 | } | 3205 | } |
3206 | hw_hndl = true; | 3206 | hw_hndl = true; |