[ofa-general] [PATCH] Non-supported functions should return NULL when returning pointers

Jon Mason jon at opengridcomputing.com
Tue Jan 15 15:50:27 PST 2008


From: Jon Mason <jon at opengridcomputing.com>

Non-supported functions should return NULL when returning pointers.
Some/Most user space programs will not check for a (void *) to -ENOSYS,
which can look like a real address until referenced.

This patch converts the uses of (void *) -ENOSYS to NULL.

Signed-off-by: Jon Mason <jon at opengridcomputing.com>
---
 src/verbs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/verbs.c b/src/verbs.c
index c6c1356..447dde3 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -263,7 +263,7 @@ int iwch_destroy_cq(struct ibv_cq *ibcq)
 struct ibv_srq *iwch_create_srq(struct ibv_pd *pd,
 				struct ibv_srq_init_attr *attr)
 {
-	return (void *) -ENOSYS;
+	return NULL;
 }
 
 int iwch_modify_srq(struct ibv_srq *srq, struct ibv_srq_attr *attr, 
@@ -407,7 +407,7 @@ int iwch_destroy_qp(struct ibv_qp *ibqp)
 
 struct ibv_ah *iwch_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr)
 {
-	return (void *) -ENOSYS;
+	return NULL;
 }
 
 int iwch_destroy_ah(struct ibv_ah *ah)
-- 
1.5.3.3



More information about the general mailing list