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

James Lentini jlentini at netapp.com
Thu Jun 23 09:49:30 PDT 2005


Committed in revision 2688 (minus the error Tom Duffy pointed out).

On Wed, 22 Jun 2005, Itamar Rabenstein wrote:

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



More information about the general mailing list