[openib-general] [PATCH][kdapl] remove NULL check for input params

Itamar Rabenstein itamar at mellanox.co.il
Wed Jun 22 07:36:35 PDT 2005


Apply This patch on top of the the previous patch set (5 patches) 

 dapl_cr.c  |   23 ----------
 dapl_ep.c  |  134 -------------------------------------------------------------
 dapl_evd.c |   36 ----------------
 dapl_ia.c  |   24 ----------
 dapl_lmr.c |   37 ----------------
 dapl_pz.c  |   36 ----------------
 dapl_rmr.c |   29 -------------
 dapl_sp.c  |   86 ---------------------------------------
 dapl_srq.c |   58 --------------------------
  9 files changed, 4 insertions(+), 459 deletions(-)

Delete Null input param check in dapl functions.

Signed-off-by: Itamar Rabenstein <itamar at mellanox.co.il>

diff -Nurp -X dontdiff dat-provider_del_hca/dapl_cr.c dat-provider/dapl_cr.c
--- dat-provider_del_hca/dapl_cr.c	Mon Jun 20 08:40:28 2005
+++ dat-provider/dapl_cr.c	Wed Jun 22 11:37:50 2005
@@ -84,11 +84,6 @@ u32 dapl_cr_accept(struct dat_cr *dat_cr
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_cr_accept (%p, %p, %d, %p)\n",
 		     dat_cr, dat_ep, priv_size, priv_data);
 
-	if (!dat_cr) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR);
-		goto bail;
-	}
-
 	cr = (struct dapl_cr *)dat_cr;
 
 	/*
@@ -569,16 +564,6 @@ u32 dapl_cr_query(struct dat_cr *dat_cr,
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_cr_query (%p, %x, %p)\n",
 		     dat_cr, cr_param);
 
-	if (dat_cr == NULL) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR);
-		goto bail;
-	}
-
-	if (NULL == cr_param) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
-		goto bail;
-	}
-
 	cr = (struct dapl_cr *)dat_cr;
 
 	/* obtain the remote IP address */
@@ -590,7 +575,6 @@ u32 dapl_cr_query(struct dat_cr *dat_cr,
 
 	status = DAT_SUCCESS;
 
-bail:
 	return status;
 }
 
@@ -609,11 +593,6 @@ u32 dapl_cr_reject(struct dat_cr *dat_cr
 
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_cr_reject (%p)\n", dat_cr);
 
-	if (!dat_cr) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR);
-		goto bail;
-	}
-
 	cr = (struct dapl_cr *)dat_cr;
 
 	/*
@@ -654,7 +633,5 @@ u32 dapl_cr_reject(struct dat_cr *dat_cr
 
 		dapl_cr_free(cr);
 	}
-
-bail:
 	return status;
 }
diff -Nurp -X dontdiff dat-provider_del_hca/dapl_ep.c dat-provider/dapl_ep.c
--- dat-provider_del_hca/dapl_ep.c	Mon Jun 20 08:40:28 2005
+++ dat-provider/dapl_ep.c	Wed Jun 22 11:38:46 2005
@@ -175,12 +175,6 @@ static u32 dapl_ep_post_send_req(struct 
 	struct dapl_cookie *cookie;
 	u32 dat_status;
 
-	if (!ep) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
-		goto bail;
-	}
-
 	ep_ptr = (struct dapl_ep *)ep;
 
 	/*
@@ -301,15 +295,6 @@ u32 dapl_ep_create(struct dat_ia *ia, st
 	ia_ptr = (struct dapl_ia *)ia;
 
 	/*
-	 * Verify parameters
-	 */
-	if (!ia_ptr) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto bail;
-	}
-
-	/*
 	 * Verify non-required parameters.
 	 * N.B. Assumption: any parameter that can be
 	 *      modified by dat_ep_modify() is not strictly
@@ -342,15 +327,6 @@ u32 dapl_ep_create(struct dat_ia *ia, st
 		goto bail;
 	}
 
-	if (ep == NULL) {
-		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG7);
-		goto bail;
-	}
-	if ((unsigned long)ep_attr & 3) {
-		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG6);
-		goto bail;
-	}
-
 	/*
 	 * Qualify EP Attributes are legal and make sense.  Note that if one
 	 * or both of the DTO handles are NULL, then the corresponding
@@ -495,15 +471,6 @@ u32 dapl_ep_create_with_srq(struct dat_i
 	ia_ptr = (struct dapl_ia *)ia;
 
 	/*
-	 * Verify parameters
-	 */
-	if (!ia_ptr) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto bail;
-	}
-
-	/*
 	 * Verify non-required parameters.
 	 * N.B. Assumption: any parameter that can be
 	 *      modified by dat_ep_modify() is not strictly
@@ -537,25 +504,6 @@ u32 dapl_ep_create_with_srq(struct dat_i
 	}
 
 	/*
-	 * Verify the SRQ handle. It is an error to invoke this call with
-	 * a NULL handle
-	 */
-	if (!srq) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
-		goto bail;
-	}
-
-	if (ep == NULL) {
-		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG7);
-		goto bail;
-	}
-	if ((unsigned long)ep_attr & 3) {
-		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG6);
-		goto bail;
-	}
-
-	/*
 	 * Qualify EP Attributes are legal and make sense.  Note that if one
 	 * or both of the DTO handles are NULL, then the corresponding
 	 * max_*_dtos must 0 as the user will not be able to post dto ops on
@@ -703,15 +651,6 @@ u32 dapl_ep_free(struct dat_ep *ep)
 	ep_ptr = (struct dapl_ep *)ep;
 	param = &ep_ptr->param;
 
-	/*
-	 * Verify parameter & state
-	 */
-	if (!ep_ptr) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
-		goto bail;
-	}
-
 	if (ep_ptr->param.ep_state == DAT_EP_STATE_RESERVED ||
 	    ep_ptr->param.ep_state == DAT_EP_STATE_PASSIVE_CONNECTION_PENDING ||
 	    ep_ptr->param.ep_state == DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING)
@@ -834,12 +773,6 @@ u32 dapl_ep_connect(struct dat_ep *ep,
 	 * Verify parameter & state. The connection handle must be good
 	 * at this point.
 	 */
-	if (!ep_ptr) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
-		goto bail;
-	}
-
 	if (!ep_ptr->param.connect_evd) {
 		dat_status =
 		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_CONN);
@@ -1036,16 +969,6 @@ u32 dapl_ep_dup_connect(struct dat_ep *e
 
 	ep_dup_ptr = (struct dapl_ep *)ep_dup;
 
-	/*
-	 * Verify the dup handle, which must be connected. All other
-	 * parameters will be verified by dapl_ep_connect
-	 */
-	if (!ep_dup) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
-		goto bail;
-	}
-
 	/* Can't do a connection in 0 time, reject outright */
 	if (timeout == 0) {
 		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
@@ -1096,15 +1019,6 @@ u32 dapl_ep_disconnect(struct dat_ep *da
 	ep = (struct dapl_ep *)dat_ep;
 
 	/*
-	 * Verify parameter & state
-	 */
-	if (!ep) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
-		goto bail;
-	}
-
-	/*
 	 * Do the verification of parameters and the state change
 	 * atomically.
 	 */
@@ -1875,11 +1789,6 @@ u32 dapl_ep_post_recv(struct dat_ep *ep,
 		     ep, num_segments, local_iov, user_cookie.as_64, 
 		     completion_flags);
 
-	if (!ep) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
-		goto bail;
-	}
-
 	ep_ptr = (struct dapl_ep *) ep;
 
 	/*
@@ -1950,19 +1859,6 @@ u32 dapl_ep_query(struct dat_ep *dat_ep,
 	ep = (struct dapl_ep *)dat_ep;
 
 	/*
-	 * Verify parameter & state
-	 */
-	if (!ep) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
-		goto bail;
-	}
-
-	if (ep_param == NULL) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
-		goto bail;
-	}
-
-	/*
 	 * Fill in according to user request
 	 *
 	 * N.B. Just slam all values into the user structure, there
@@ -1978,7 +1874,6 @@ u32 dapl_ep_query(struct dat_ep *dat_ep,
             (struct sockaddr *)&ep->remote_ia_address;
         *ep_param = ep->param;
 
-bail:
 	return status;
 }
 
@@ -1993,18 +1888,8 @@ u32 dapl_ep_recv_query(struct dat_ep *ep
 
 	ep_ptr = (struct dapl_ep *)ep;
 
-	/*
-	 * Verify parameter & state
-	 */
-	if (!ep_ptr) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
-		goto bail;
-	}
-
 	dat_status = DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE);
 
-bail:
 	return dat_status;
 
 }
@@ -2016,15 +1901,6 @@ u32 dapl_ep_reset(struct dat_ep *ep)
 
 	ep_ptr = (struct dapl_ep *)ep;
 
-	/*
-	 * Verify parameter & state
-	 */
-	if (!ep_ptr) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
-		goto bail;
-	}
-
 	if (ep_ptr->param.ep_state != DAT_EP_STATE_UNCONNECTED
 	    && ep_ptr->param.ep_state != DAT_EP_STATE_DISCONNECTED) {
 		dat_status =
@@ -2053,18 +1929,8 @@ u32 dapl_ep_set_watermark(struct dat_ep 
 
 	ep_ptr = (struct dapl_ep *)ep;
 
-	/*
-	 * Verify parameter & state
-	 */
-	if (!ep_ptr) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
-		goto bail;
-	}
-
 	dat_status = DAT_NOT_IMPLEMENTED;
 
-bail:
 	return dat_status;
 
 }
diff -Nurp -X dontdiff dat-provider_del_hca/dapl_evd.c dat-provider/dapl_evd.c
--- dat-provider_del_hca/dapl_evd.c	Mon Jun 20 08:40:28 2005
+++ dat-provider/dapl_evd.c	Wed Jun 22 11:39:25 2005
@@ -1013,11 +1013,6 @@ u32 dapl_evd_kcreate(struct dat_ia *ia_h
 	evd = NULL;
 	*evd_handle = NULL;
 
-	if (!ia_handle) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto bail;
-	}
-
 	if (min_qlen <= 0) {
 		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);
 		goto bail;
@@ -1060,11 +1055,6 @@ u32 dapl_evd_free(struct dat_evd *evd_ha
 
 	evd = (struct dapl_evd *)evd_handle;
 
-	if (!evd_handle) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, 0);
-		goto bail;
-	}
-
 	if (atomic_read(&evd->evd_ref_count) != 0) {
 		status =
 		    DAT_ERROR(DAT_INVALID_STATE, DAT_INVALID_STATE_EVD_IN_USE);
@@ -1090,11 +1080,6 @@ u32 dapl_evd_kquery(struct dat_evd *evd_
 	struct dapl_evd *evd;
 	u32 status = DAT_SUCCESS;
 
-	if (NULL == evd_param) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
-		goto bail;
-	}
-
 	/* Note: the spec. allows for events to be directed to a NULL EVD */
 	/* with handle of type NULL. See 6.3.1                 */
 	if (NULL == evd_handle) {
@@ -1138,15 +1123,9 @@ u32 dapl_evd_modify_upcall(struct dat_ev
 
 	evd = (struct dapl_evd *)evd_handle;
 
-	if (!evd_handle) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, 0);
-		goto bail;
-	}
-
 	evd->upcall_policy = upcall_policy;
 	evd->upcall = *upcall;
 
-bail:
 	return status;
 }
 
@@ -1195,16 +1174,6 @@ u32 dapl_evd_dequeue(struct dat_evd *evd
 
 	evd = (struct dapl_evd *)evd_handle;
 
-	if (!evd_handle) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, 0);
-		goto bail;
-	}
-
-	if (event == NULL) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);
-		goto bail;
-	}
-
 	/*
 	 * We need to dequeue under lock, as the IB OS Access API
 	 * restricts us from having multiple threads in CQ poll, and the
@@ -1255,11 +1224,6 @@ u32 dapl_evd_resize(struct dat_evd *evd_
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_evd_resize (%p, %d)\n",
 		     evd_handle, evd_qlen);
 
-	if (!evd_handle) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, 0);
-		goto bail;
-	}
-
 	evd = (struct dapl_evd *)evd_handle;
 	ia = evd->common.owner_ia;
 
diff -Nurp -X dontdiff dat-provider_del_hca/dapl_ia.c dat-provider/dapl_ia.c
--- dat-provider_del_hca/dapl_ia.c	Mon Jun 20 08:40:28 2005
+++ dat-provider/dapl_ia.c	Wed Jun 22 11:40:02 2005
@@ -611,16 +611,6 @@ u32 dapl_ia_open(const char *name, int a
 		goto bail;
 	}
 
-	/* ia_ptr and async_evd cannot be NULL */
-	if (ia_ptr == NULL) {
-		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG4);
-		goto bail;
-	}
-	if (async_evd == NULL) {
-		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
-		goto bail;
-	}
-
 	/* initialize the caller's param */
 	*ia_ptr = NULL;
 
@@ -710,12 +700,6 @@ u32 dapl_ia_close(struct dat_ia *ia_ptr,
 
 	ia = (struct dapl_ia *)ia_ptr;
 
-	if (!ia) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto bail;
-	}
-
 	if (DAT_CLOSE_ABRUPT_FLAG == ia_flags)
 		dat_status = dapl_ia_abrupt_close(ia);
 	else if (DAT_CLOSE_GRACEFUL_FLAG == ia_flags)
@@ -723,7 +707,6 @@ u32 dapl_ia_close(struct dat_ia *ia_ptr,
 	else
 		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);
 
-bail:
 	return dat_status;
 }
 
@@ -783,12 +766,6 @@ u32 dapl_ia_query(struct dat_ia *ia_ptr,
 
 	ia = (struct dapl_ia *)ia_ptr;
 
-	if (!ia) {
-		dat_status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto bail;
-	}
-
 	if (NULL != async_evd) {
 		*async_evd = (struct dat_evd *)ia->async_error_evd;
 	}
@@ -862,7 +839,6 @@ u32 dapl_ia_query(struct dat_ia *ia_ptr,
 #endif				/* DAPL_MERGE_CM_DTO */
 	}
 
-bail:
 	dapl_dbg_log(DAPL_DBG_TYPE_RTN,
 		     "dapl_ia_query () returns 0x%x\n", dat_status);
 
diff -Nurp -X dontdiff dat-provider_del_hca/dapl_lmr.c dat-provider/dapl_lmr.c
--- dat-provider_del_hca/dapl_lmr.c	Mon Jun 20 08:40:28 2005
+++ dat-provider/dapl_lmr.c	Wed Jun 22 11:45:13 2005
@@ -241,15 +241,6 @@ u32 dapl_lmr_kcreate(struct dat_ia *ia, 
 		     "dapl_lmr_kcreate(ia:%p, mem_type:%x, ...)\n",
 		     ia, mem_type);
 
-	if (!ia) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto bail;
-	}
-	if (!pz) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ);
-		goto bail;
-	}
-
 	dapl_ia = (struct dapl_ia *)ia;
 	dapl_pz = (struct dapl_pz *)pz;
 
@@ -309,11 +300,6 @@ u32 dapl_lmr_free(struct dat_lmr *lmr)
 
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_lmr_free (%p)\n", lmr);
 
-	if (!lmr) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_LMR);
-		goto error;
-	}
-
 	dapl_lmr = (struct dapl_lmr *)lmr;
 
 	switch (dapl_lmr->param.mem_type) {
@@ -343,7 +329,6 @@ u32 dapl_lmr_free(struct dat_lmr *lmr)
 		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG1);
 		break;
 	}
-error:
 	return status;
 }
 
@@ -355,19 +340,9 @@ u32 dapl_lmr_query(struct dat_lmr *lmr, 
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_lmr_query (%p, %p)\n",
 		     lmr, lmr_param);
 
-	if (!lmr) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_LMR);
-		goto error;
-	}
-	if (NULL == lmr_param) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
-		goto error;
-	}
-	
 	dapl_lmr = (struct dapl_lmr *)lmr;
 	memcpy(lmr_param, &dapl_lmr->param, sizeof *lmr_param);
 	status = DAT_SUCCESS;
-error:
 	return status;
 }
 
@@ -388,12 +363,6 @@ u32 dapl_lmr_sync_rdma_read(struct dat_i
 
 	ia_ptr = (struct dapl_ia *)ia;
 
-	if (!ia_ptr) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto error;
-	}
-
-error:
 	return status;
 }
 
@@ -409,11 +378,5 @@ u32 dapl_lmr_sync_rdma_write(struct dat_
 
 	ia_ptr = (struct dapl_ia *)ia;
 	
-	if (!ia_ptr) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto error;
-	}
-
-error:
 	return status;
 }
diff -Nurp -X dontdiff dat-provider_del_hca/dapl_pz.c dat-provider/dapl_pz.c
--- dat-provider_del_hca/dapl_pz.c	Mon Jun 20 08:40:28 2005
+++ dat-provider/dapl_pz.c	Wed Jun 22 11:41:13 2005
@@ -75,40 +75,23 @@ u32 dapl_pz_create(struct dat_ia *ia, st
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_pz_create(%p, %p)\n", 
 		     ia, pz);
 
-	if (!ia) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto error1;
-	}
-	if (NULL == pz) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);
-		goto error1;
-	}
-	
 	dapl_ia = (struct dapl_ia *)ia;
 
 	dapl_pz = dapl_pz_alloc(dapl_ia);
-	if (!dapl_pz) {
-		status = 
-		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
-		goto error1;
-	}
-
 	dapl_pz->pd = ib_alloc_pd(dapl_ia->hca->ib_hca_handle);
 	if (IS_ERR(dapl_pz->pd)) {
 		ib_status = PTR_ERR(dapl_pz->pd);
 		dapl_dbg_log(DAPL_DBG_TYPE_ERR, "ib_alloc_pd failed: %X\n",
 			     ib_status);
 		status = dapl_ib_status_convert(ib_status);
-		goto error2;
+		goto error;
 	}
 	
 	*pz = (struct dat_pz *)dapl_pz;
 	return DAT_SUCCESS;
 
-error2:
+error:
 	dapl_pz_dealloc(dapl_pz);
-	
-error1:
 	*pz = NULL;
 	return status;
 }
@@ -121,11 +104,6 @@ u32 dapl_pz_free(struct dat_pz *pz)
 
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_pz_free(%p)\n", pz);
 
-	if (!pz) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ);
-		goto error;
-	}
-
 	dapl_pz = (struct dapl_pz *)pz;
 
 	if (0 != atomic_read(&dapl_pz->pz_ref_count)) {
@@ -157,19 +135,9 @@ u32 dapl_pz_query(struct dat_pz *pz, str
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_pz_query(%p, %x, %p)\n", 
 		     pz, pz_param);
 
-	if (!pz) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ);
-		goto error;
-	}
-	if (NULL == pz_param) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
-		goto error;
-	}
-
 	dapl_pz = (struct dapl_pz *)pz;
 	pz_param->ia = (struct dat_ia *)dapl_pz->common.owner_ia;
 	return DAT_SUCCESS;
 
-error:
 	return status;
 }
diff -Nurp -X dontdiff dat-provider_del_hca/dapl_rmr.c dat-provider/dapl_rmr.c
--- dat-provider_del_hca/dapl_rmr.c	Mon Jun 20 08:40:28 2005
+++ dat-provider/dapl_rmr.c	Wed Jun 22 11:41:36 2005
@@ -354,15 +354,6 @@ u32 dapl_rmr_bind(struct dat_rmr *rmr_ha
 	struct dapl_lmr *lmr;
 	struct dapl_ep *ep_ptr;
 
-	if (!rmr_handle)
-		return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RMR);
-
-	if (!lmr_handle)
-		return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_LMR);
-
-	if (!ep)
-		return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
-
 	rmr = (struct dapl_rmr *)rmr_handle;
 	lmr = (struct dapl_lmr *)lmr_handle;
 	ep_ptr = (struct dapl_ep *)ep;
@@ -399,11 +390,6 @@ u32 dapl_rmr_create(struct dat_pz *pz, s
 	struct dapl_rmr *dapl_rmr;
 	u32 status = DAT_SUCCESS;
 
-	if (!pz) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ);
-		goto bail;
-	}
-
 	dapl_pz = (struct dapl_pz *)pz;
 
 	dapl_rmr = dapl_rmr_alloc(dapl_pz);
@@ -451,11 +437,6 @@ u32 dapl_rmr_free(struct dat_rmr *rmr_ha
 	struct dapl_rmr *rmr;
 	u32 status = DAT_SUCCESS;
 
-	if (!rmr_handle) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RMR);
-		goto bail;
-	}
-
 	rmr = (struct dapl_rmr *)rmr_handle;
 
 	/*
@@ -485,19 +466,9 @@ u32 dapl_rmr_query(struct dat_rmr *rmr_h
 	struct dapl_rmr *rmr;
 	u32 status = DAT_SUCCESS;
 
-	if (!rmr_handle) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RMR);
-		goto bail;
-	}
-	if (NULL == rmr_param) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
-		goto bail;
-	}
-
 	rmr = (struct dapl_rmr *)rmr_handle;
 
 	memcpy(rmr_param, &rmr->param, sizeof *rmr_param);
 
-bail:
 	return status;
 }
diff -Nurp -X dontdiff dat-provider_del_hca/dapl_sp.c dat-provider/dapl_sp.c
--- dat-provider_del_hca/dapl_sp.c	Mon Jun 20 08:40:28 2005
+++ dat-provider/dapl_sp.c	Wed Jun 22 11:41:57 2005
@@ -145,25 +145,6 @@ u32 dapl_rsp_create(struct dat_ia *dat_i
 		     ">>> dapl_rsp_free conn_qual: %x EP: %p\n",
 		     conn_qual, dat_ep);
 
-	if (!dat_ia) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto bail;
-	}
-	if (!dat_ep) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
-		goto bail;
-	}
-	if (!dat_evd) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE,
-				   DAT_INVALID_HANDLE_EVD_CR);
-		goto bail;
-	}
-
-	if (rsp == NULL) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG5);
-		goto bail;
-	}
-
 	ia = (struct dapl_ia *)dat_ia;
 
 	ep = (struct dapl_ep *)dat_ep;
@@ -263,14 +244,8 @@ u32 dapl_rsp_free(struct dat_sp *dat_rsp
 	u32 status = DAT_SUCCESS;
 
 	sp = (struct dapl_sp *)dat_rsp;
-	/*
-	 * Verify handle
-	 */
+
 	dapl_dbg_log(DAPL_DBG_TYPE_CM, ">>> dapl_rsp_free %p\n", dat_rsp);
-	if (!sp) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RSP);
-		goto bail;
-	}
 
 	ia = sp->common.owner_ia;
 
@@ -341,16 +316,6 @@ u32 dapl_rsp_query(struct dat_sp *dat_rs
 	struct dapl_sp *sp;
 	u32 status;
 
-	if (!dat_rsp) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RSP);
-		goto bail;
-	}
-
-	if (NULL == rsp_param) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
-		goto bail;
-	}
-
 	sp = (struct dapl_sp *)dat_rsp;
 
 	/*
@@ -363,7 +328,6 @@ u32 dapl_rsp_query(struct dat_sp *dat_rs
 
 	status = DAT_SUCCESS;
 
-bail:
 	return status;
 }
 
@@ -390,25 +354,6 @@ u32 dapl_psp_create_any(struct dat_ia *d
 		     "dapl_psp_create_anny(%p, %p, %p, %X, %p)\n",
 		     dat_ia, conn_qual, dat_evd, psp_flags, dat_psp);
 
-	if (!dat_ia) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto bail;
-	}
-	if (!dat_evd) {
-		status =
-		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_CR);
-		goto bail;
-	}
-
-	if (!dat_psp) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG5);
-		goto bail;
-	}
-	if (conn_qual == NULL) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);
-		goto bail;
-	}
-
 	ia = (struct dapl_ia *)dat_ia;
 	evd = (struct dapl_evd *)dat_evd;
 	if (!(evd->evd_flags & DAT_EVD_CR_FLAG)) {
@@ -510,21 +455,6 @@ u32 dapl_psp_create(struct dat_ia *dat_i
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_psp_create(%p, %X, %p, %X, %p)\n",
 		     dat_ia, conn_qual, dat_evd, psp_flags, dat_psp);
 
-	if (!dat_ia) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto bail;
-	}
-	if (!dat_evd) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE,
-				   DAT_INVALID_HANDLE_EVD_CR);
-		goto bail;
-	}
-
-	if (!dat_psp) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG5);
-		goto bail;
-	}
-
 	ia = (struct dapl_ia *)dat_ia;
 	evd = (struct dapl_evd *)dat_evd;
 	if (!(evd->evd_flags & DAT_EVD_CR_FLAG)) {
@@ -628,15 +558,8 @@ u32 dapl_psp_free(struct dat_sp *dat_psp
 	u32 status = DAT_SUCCESS;
 
 	sp = (struct dapl_sp *)dat_psp;
-	/*
-	 * Verify handle
-	 */
-	dapl_dbg_log(DAPL_DBG_TYPE_CM, ">>> dapl_psp_free %p\n", dat_psp);
 
-	if (!sp) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PSP);
-		goto bail;
-	}
+	dapl_dbg_log(DAPL_DBG_TYPE_CM, ">>> dapl_psp_free %p\n", dat_psp);
 
 	ia = sp->common.owner_ia;
 	/* 
@@ -712,11 +635,6 @@ u32 dapl_psp_query(struct dat_sp *dat_ps
 		goto bail;
 	}
 
-	if (NULL == psp_param) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
-		goto bail;
-	}
-
 	sp = (struct dapl_sp *)dat_psp;
 
 	psp_param->ia = sp->ia;
diff -Nurp -X dontdiff dat-provider_del_hca/dapl_srq.c dat-provider/dapl_srq.c
--- dat-provider_del_hca/dapl_srq.c	Mon Jun 20 08:40:27 2005
+++ dat-provider/dapl_srq.c	Wed Jun 22 11:42:23 2005
@@ -149,30 +149,6 @@ u32 dapl_srq_create(struct dat_ia *ia, s
 
 	ia_ptr = (struct dapl_ia *)ia;
 
-	/*
-	 * Verify parameters
-	 */
-	if (!ia_ptr) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
-		goto bail;
-	}
-
-	/*
-	 * Verify non-required parameters.
-	 * N.B. Assumption: any parameter that can be
-	 *      modified by dat_ep_modify() is not strictly
-	 *      required when the EP is created
-	 */
-	if (srq == NULL) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG4);
-		goto bail;
-	}
-	if ((unsigned long)srq_attr & 3) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
-		goto bail;
-	}
-
-	/* Allocate SRQ */
 	srq_ptr = dapl_srq_alloc(ia_ptr, srq_attr);
 	if (srq_ptr == NULL) {
 		status = DAT_ERROR(DAT_INSUFFICIENT_RESOURCES,
@@ -228,14 +204,6 @@ u32 dapl_srq_free(struct dat_srq *srq)
 	srq_ptr = (struct dapl_srq *)srq;
 	param = &srq_ptr->param;
 
-	/*
-	 * Verify parameter & state
-	 */
-	if (!srq_ptr) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
-		goto bail;
-	}
-
 	if (atomic_read(&srq_ptr->srq_ref_count) != 0) {
 		/*
 		 * The DAPL 1.2 spec says to return DAT_SRQ_IN_USE, which does
@@ -313,11 +281,6 @@ u32 dapl_srq_post_recv(struct dat_srq *s
 		     "dapl_srq_post_recv (%p, %d, %p, %P)\n",
 		     srq, num_segments, local_iov, user_cookie.as_64);
 
-	if (!srq) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
-		goto bail;
-	}
-
 	srq_ptr = (struct dapl_srq *)srq;
 
 	/*
@@ -360,15 +323,6 @@ u32 dapl_srq_query(struct dat_srq *srq, 
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_srq_query (%p, %x, %p)\n", srq,
 		     srq_param);
 
-	if (!srq) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
-		goto bail;
-	}
-	if (srq_param == NULL) {
-		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
-		goto bail;
-	}
-
 	srq_ptr = (struct dapl_srq *)srq;
 
 	/*
@@ -379,7 +333,6 @@ u32 dapl_srq_query(struct dat_srq *srq, 
 
 	*srq_param = srq_ptr->param;
 
-bail:
 	return status;
 }
 
@@ -412,11 +365,6 @@ u32 dapl_srq_resize(struct dat_srq *srq,
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_srq_resize (%p, %d)\n",
 		     srq, srq_max_recv_dto);
 
-	if (!srq) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
-		goto bail;
-	}
-
 	srq_ptr = (struct dapl_srq *)srq;
 	ia_ptr = srq_ptr->common.owner_ia;
 
@@ -466,17 +414,11 @@ u32 dapl_srq_set_lw(struct dat_srq *srq,
 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_srq_set_lw (%p, %d)\n", srq,
 		     low_watermark);
 
-	if (!srq) {
-		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
-		goto bail;
-	}
-
 	srq_ptr = (struct dapl_srq *)srq;
 
 	/* XXX Put implementation here XXX */
 
 	/* XXX */ status = DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE);
 
-bail:
 	return status;
 }
-- 
Itamar



More information about the general mailing list