git: cb722b67796d - main - ibcore: Remove the use of NULL_IB_OBJECT
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 12 Apr 2024 17:21:11 UTC
The branch main has been updated by khng:
URL: https://cgit.FreeBSD.org/src/commit/?id=cb722b67796ddc700c73919183e80049c3ec17f3
commit cb722b67796ddc700c73919183e80049c3ec17f3
Author: Ka Ho Ng <khng@FreeBSD.org>
AuthorDate: 2024-04-12 16:57:35 +0000
Commit: Ka Ho Ng <khng@FreeBSD.org>
CommitDate: 2024-04-12 17:04:23 +0000
ibcore: Remove the use of NULL_IB_OBJECT
LinuxKPI's XArray implementation accepts NULL as an input as of the
following commit:
- linuxkpi: Accept NULL as a value in linux_xarray (3102ea3b15b6)
Sponsored by: Juniper Networks, Inc.
MFC after: 1 week
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44533
---
sys/ofed/drivers/infiniband/core/ib_rdma_core.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sys/ofed/drivers/infiniband/core/ib_rdma_core.c b/sys/ofed/drivers/infiniband/core/ib_rdma_core.c
index d259449f698e..456c5df9a22f 100644
--- a/sys/ofed/drivers/infiniband/core/ib_rdma_core.c
+++ b/sys/ofed/drivers/infiniband/core/ib_rdma_core.c
@@ -293,8 +293,6 @@ static struct ib_uobject *alloc_uobj(struct uverbs_attr_bundle *attrs,
return uobj;
}
-#define NULL_IB_UOBJECT ((struct ib_uobject *)1)
-
static int idr_add_uobj(struct ib_uobject *uobj)
{
/*
@@ -302,7 +300,7 @@ static int idr_add_uobj(struct ib_uobject *uobj)
* object which isn't initialized yet. We'll replace it later on with
* the real object once we commit.
*/
- return xa_alloc(&uobj->ufile->idr, &uobj->id, NULL_IB_UOBJECT, xa_limit_32b,
+ return xa_alloc(&uobj->ufile->idr, &uobj->id, NULL, xa_limit_32b,
GFP_KERNEL);
}
@@ -325,7 +323,7 @@ lookup_get_idr_uobject(const struct uverbs_api_object *obj,
* kfree() could be called at any time.
*/
uobj = xa_load(&ufile->idr, id);
- if (!uobj || uobj == NULL_IB_UOBJECT || !kref_get_unless_zero(&uobj->ref))
+ if (!uobj || !kref_get_unless_zero(&uobj->ref))
uobj = ERR_PTR(-ENOENT);
rcu_read_unlock();
return uobj;
@@ -589,7 +587,7 @@ static void alloc_commit_idr_uobject(struct ib_uobject *uobj)
* It will be put by remove_commit_idr_uobject()
*/
old = xa_store(&ufile->idr, uobj->id, uobj, GFP_KERNEL);
- WARN_ON(old != NULL_IB_UOBJECT);
+ WARN_ON(old != NULL);
}
static void alloc_commit_fd_uobject(struct ib_uobject *uobj)