From: Leon Romanovsky <leonro@xxxxxxxxxxxx> In following patch, the allocation of AH will be moved to RDMA/core responsibility with kzalloc and kfree out of drivers scope. It will leave empty destroy_ah functions in drivers, to simplify the code we will skip calls to driver destroy_ah if it is empty. Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> --- drivers/infiniband/core/verbs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 5a5e83f5f0fc..50436922b24f 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -934,12 +934,14 @@ int rdma_destroy_ah(struct ib_ah *ah, u32 flags) { const struct ib_gid_attr *sgid_attr = ah->sgid_attr; struct ib_pd *pd; - int ret; + int ret = 0; might_sleep_if(flags & RDMA_DESTROY_AH_SLEEPABLE); pd = ah->pd; - ret = ah->device->ops.destroy_ah(ah, flags); + + if (ah->device->ops.destroy_ah) + ret = ah->device->ops.destroy_ah(ah, flags); if (!ret) { atomic_dec(&pd->usecnt); if (sgid_attr) -- 2.20.1