[openib-general] [PATCH]remove redundant assignment in ib_post_send_mad()

Sean Hefty mshefty at ichips.intel.com
Mon Nov 1 15:06:20 PST 2004


On Mon, 1 Nov 2004 15:01:26 -0800
Shirley Ma <mashirle at us.ibm.com> wrote:

> I am using my unix account to send the patch. Hope it works.
> 
> diff -urN access/mad.c access.patch2/mad.c
> --- access/mad.c	2004-11-01 14:51:41.356902216 -0800
> +++ access.patch2/mad.c	2004-11-01 14:53:37.003321288 -0800
> @@ -368,16 +368,15 @@
>  	struct ib_mad_agent_private	*mad_agent_priv;
>  	struct ib_mad_port_private	*port_priv;
>  
> -	cur_send_wr = send_wr;
>  	/* Validate supplied parameters */
>  	if (!mad_agent || !send_wr) {
> -		*bad_send_wr = cur_send_wr;
> +		*bad_send_wr = send_wr;
>  		return -EINVAL;
>  	}
>  
>  	if (!mad_agent->send_handler ||
>  	    (send_wr->wr.ud.timeout_ms && !mad_agent->recv_handler)) {
> -		*bad_send_wr = cur_send_wr;
> +		*bad_send_wr = send_wr;
>  		return -EINVAL;
>  	}

Patch looks good to me, and should be applied

It raises an issue with the current code, though.  There are checks for
a valid mad_agent, valid_wr, but not a valid *bad_send_wr.  I'm
wondering if we should convert these checks to BUG_ON, or add in a check
for a *bad_send_wr.  As a minor optimization, we could make bad_send_wr
optional for cases where only a single work request is being posted.

- Sean



More information about the general mailing list