aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/counters.c
diff options
context:
space:
mode:
authorMark Zhang <[email protected]>2021-10-08 12:24:30 +0000
committerJason Gunthorpe <[email protected]>2021-10-12 15:48:04 +0000
commit0a0800ce2a6a4d58d73f712f1c0780974877babf (patch)
tree0782d5e7550354223700a4625637bc48d9171c68 /drivers/infiniband/core/counters.c
parentRDMA/counter: Add a descriptor in struct rdma_hw_stats (diff)
downloadkernel-0a0800ce2a6a4d58d73f712f1c0780974877babf.tar.gz
kernel-0a0800ce2a6a4d58d73f712f1c0780974877babf.zip
RDMA/core: Add a helper API rdma_free_hw_stats_struct
Add a new API rdma_free_hw_stats_struct to pair with rdma_alloc_hw_stats_struct (which is also de-inlined). This will be useful when there are more alloc/free works in following patches. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Mark Zhang <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
Diffstat (limited to 'drivers/infiniband/core/counters.c')
-rw-r--r--drivers/infiniband/core/counters.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/infiniband/core/counters.c b/drivers/infiniband/core/counters.c
index df9e6c5e4ddf..331cd29f0d61 100644
--- a/drivers/infiniband/core/counters.c
+++ b/drivers/infiniband/core/counters.c
@@ -165,7 +165,7 @@ static struct rdma_counter *alloc_and_bind(struct ib_device *dev, u32 port,
return counter;
err_mode:
- kfree(counter->stats);
+ rdma_free_hw_stats_struct(counter->stats);
err_stats:
rdma_restrack_put(&counter->res);
kfree(counter);
@@ -186,7 +186,7 @@ static void rdma_counter_free(struct rdma_counter *counter)
mutex_unlock(&port_counter->lock);
rdma_restrack_del(&counter->res);
- kfree(counter->stats);
+ rdma_free_hw_stats_struct(counter->stats);
kfree(counter);
}
@@ -618,7 +618,7 @@ void rdma_counter_init(struct ib_device *dev)
fail:
for (i = port; i >= rdma_start_port(dev); i--) {
port_counter = &dev->port_data[port].port_counter;
- kfree(port_counter->hstats);
+ rdma_free_hw_stats_struct(port_counter->hstats);
port_counter->hstats = NULL;
mutex_destroy(&port_counter->lock);
}
@@ -631,7 +631,7 @@ void rdma_counter_release(struct ib_device *dev)
rdma_for_each_port(dev, port) {
port_counter = &dev->port_data[port].port_counter;
- kfree(port_counter->hstats);
+ rdma_free_hw_stats_struct(port_counter->hstats);
mutex_destroy(&port_counter->lock);
}
}