[ofa-general] RE: [2.6 patch] infiniband/hw/nes/nes_verbs.c: remove dead code

Glenn Streiff gstreiff at NetEffect.com
Tue Feb 19 13:43:54 PST 2008


> --- linux-2.6/drivers/infiniband/hw/nes/nes_verbs.c.old	
> 2008-02-19 20:23:02.000000000 +0200
> +++ linux-2.6/drivers/infiniband/hw/nes/nes_verbs.c	
> 2008-02-19 20:24:34.000000000 +0200
> @@ -1638,95 +1638,89 @@ static struct ib_cq *nes_create_cq(struc
>  
>  	err = nes_alloc_resource(nesadapter, nesadapter->allocated_cqs,
>  			nesadapter->max_cq, &cq_num, &nesadapter->next_cq);
>  	if (err) {
>  		return ERR_PTR(err);
>  	}
>  
      ...
>  		nes_debug(NES_DBG_CQ, "CQ Virtual Address = 
> %08lX, size = %u.\n",
>  				(unsigned long)req.user_cq_buffer, entries);
>  		list_for_each_entry(nespbl, &nes_ucontext->cq_reg_mem_list, list) {
>  			if (nespbl->user_base == (unsigned long)req.user_cq_buffer) {
>  				list_del(&nespbl->list);
> -				err = 0;
>  				nes_debug(NES_DBG_CQ, "Found 
> PBL for virtual CQ. nespbl=%p.\n",
>  						nespbl);
>  				break;
>  			}
>  		}
> -		if (err) {
> -			nes_free_resource(nesadapter, 
> nesadapter->allocated_cqs, cq_num);
> -			kfree(nescq);
> -			return ERR_PTR(err);
> -		}
>  

Hi, Adrian.

I agree that coverity found some dead code as written.

It may be the case that err should be set to some non-zero
value upstream of the 0 assignment.  Let me get Faisal
to respond in that case since this looks like his code.
He should be in later today.  Otherwise I'll ack.

Thanks for the review,

Glenn


More information about the general mailing list