Skip to content

Commit 71ff3f6

Browse files
Leon Romanovskyjgunthorpe
authored andcommitted
RDMA: Make counters destroy symmetrical
Change counters to return failure like any other verbs destroy, however this flow shouldn't return error at all. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent add5353 commit 71ff3f6

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

drivers/infiniband/core/uverbs_std_types_counters.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ static int uverbs_free_counters(struct ib_uobject *uobject,
4646
if (ret)
4747
return ret;
4848

49-
counters->device->ops.destroy_counters(counters);
49+
ret = counters->device->ops.destroy_counters(counters);
50+
if (ret)
51+
return ret;
5052
kfree(counters);
5153
return 0;
5254
}

drivers/infiniband/hw/mlx5/counters.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,15 @@ static int mlx5_ib_read_counters(struct ib_counters *counters,
117117
return ret;
118118
}
119119

120-
static void mlx5_ib_destroy_counters(struct ib_counters *counters)
120+
static int mlx5_ib_destroy_counters(struct ib_counters *counters)
121121
{
122122
struct mlx5_ib_mcounters *mcounters = to_mcounters(counters);
123123

124124
mlx5_ib_counters_clear_description(counters);
125125
if (mcounters->hw_cntrs_hndl)
126126
mlx5_fc_destroy(to_mdev(counters->device)->mdev,
127127
mcounters->hw_cntrs_hndl);
128+
return 0;
128129
}
129130

130131
static int mlx5_ib_create_counters(struct ib_counters *counters,

include/rdma/ib_verbs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2498,7 +2498,7 @@ struct ib_device_ops {
24982498
struct uverbs_attr_bundle *attrs);
24992499
int (*create_counters)(struct ib_counters *counters,
25002500
struct uverbs_attr_bundle *attrs);
2501-
void (*destroy_counters)(struct ib_counters *counters);
2501+
int (*destroy_counters)(struct ib_counters *counters);
25022502
int (*read_counters)(struct ib_counters *counters,
25032503
struct ib_counters_read_attr *counters_read_attr,
25042504
struct uverbs_attr_bundle *attrs);

0 commit comments

Comments
 (0)