diff mbox

IB/ocrdma_hw: remove unnecessary code in ocrdma_mbx_dealloc_lkey

Message ID 20171106143514.GA19786@embeddedor.com (mailing list archive)
State Superseded
Headers show

Commit Message

Gustavo A. R. Silva Nov. 6, 2017, 2:35 p.m. UTC
Check on return value and goto label mbx_err are unnecessary.

Addresses-Coverity-ID: 1268780
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Yuval Shaia Nov. 7, 2017, 6:31 a.m. UTC | #1
On Mon, Nov 06, 2017 at 08:35:14AM -0600, Gustavo A. R. Silva wrote:
> Check on return value and goto label mbx_err are unnecessary.
> 
> Addresses-Coverity-ID: 1268780

What's that?

> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
>  drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
> index f8c14c7..db02bbb 100644
> --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
> +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
> @@ -1956,9 +1956,7 @@ int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev *dev, int fr_mr, u32 lkey)
>  	cmd->lkey = lkey;
>  	cmd->rsvd_frmr = fr_mr ? 1 : 0;
>  	status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd);
> -	if (status)
> -		goto mbx_err;
> -mbx_err:
> +
>  	kfree(cmd);
>  	return status;

Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>

>  }
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leon Romanovsky Nov. 7, 2017, 8:25 a.m. UTC | #2
On Mon, Nov 06, 2017 at 08:35:14AM -0600, Gustavo A. R. Silva wrote:
> Check on return value and goto label mbx_err are unnecessary.
>
> Addresses-Coverity-ID: 1268780
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
>  drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
> index f8c14c7..db02bbb 100644
> --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
> +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
> @@ -1956,9 +1956,7 @@ int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev *dev, int fr_mr, u32 lkey)
>  	cmd->lkey = lkey;
>  	cmd->rsvd_frmr = fr_mr ? 1 : 0;
>  	status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd);
> -	if (status)
> -		goto mbx_err;
> -mbx_err:
> +

Can you please remove assignment from "int status = -ENOMEM"?
It produces warning too.

Thanks


>  	kfree(cmd);
>  	return status;
>  }
> --
> 2.7.4
>
Gustavo A. R. Silva Nov. 7, 2017, 2:27 p.m. UTC | #3
Hi Yuval,

Quoting Yuval Shaia <yuval.shaia@oracle.com>:

> On Mon, Nov 06, 2017 at 08:35:14AM -0600, Gustavo A. R. Silva wrote:
>> Check on return value and goto label mbx_err are unnecessary.
>>
>> Addresses-Coverity-ID: 1268780
>
> What's that?
>

Coverity is a static code analyzer.
I am fixing Coverity issues and that is the ID Coverity assigned to  
this particular issue.

>> ---
>>  drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c  
>> b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
>> index f8c14c7..db02bbb 100644
>> --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
>> +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
>> @@ -1956,9 +1956,7 @@ int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev  
>> *dev, int fr_mr, u32 lkey)
>>  	cmd->lkey = lkey;
>>  	cmd->rsvd_frmr = fr_mr ? 1 : 0;
>>  	status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd);
>> -	if (status)
>> -		goto mbx_err;
>> -mbx_err:
>> +
>>  	kfree(cmd);
>>  	return status;
>
> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
>

Thank you
--
Gustavo A. R. Silva





--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gustavo A. R. Silva Nov. 7, 2017, 2:30 p.m. UTC | #4
Hi Leon,

Quoting Leon Romanovsky <leon@kernel.org>:

> On Mon, Nov 06, 2017 at 08:35:14AM -0600, Gustavo A. R. Silva wrote:
>> Check on return value and goto label mbx_err are unnecessary.
>>
>> Addresses-Coverity-ID: 1268780
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>> ---
>>  drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c  
>> b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
>> index f8c14c7..db02bbb 100644
>> --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
>> +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
>> @@ -1956,9 +1956,7 @@ int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev  
>> *dev, int fr_mr, u32 lkey)
>>  	cmd->lkey = lkey;
>>  	cmd->rsvd_frmr = fr_mr ? 1 : 0;
>>  	status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd);
>> -	if (status)
>> -		goto mbx_err;
>> -mbx_err:
>> +
>
> Can you please remove assignment from "int status = -ENOMEM"?
> It produces warning too.
>

OK. Will do.

By the way, which compiler triggers that warning?

I'm using GCC 7.2.0 and I don't see it.

Thanks
--
Gustavo A. R. Silva





--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leon Romanovsky Nov. 7, 2017, 2:44 p.m. UTC | #5
On Tue, Nov 07, 2017 at 08:30:22AM -0600, Gustavo A. R. Silva wrote:
> Hi Leon,
>
> Quoting Leon Romanovsky <leon@kernel.org>:
>
> > On Mon, Nov 06, 2017 at 08:35:14AM -0600, Gustavo A. R. Silva wrote:
> > > Check on return value and goto label mbx_err are unnecessary.
> > >
> > > Addresses-Coverity-ID: 1268780
> > > Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> > > ---
> > >  drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +---
> > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
> > > b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
> > > index f8c14c7..db02bbb 100644
> > > --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
> > > +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
> > > @@ -1956,9 +1956,7 @@ int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev
> > > *dev, int fr_mr, u32 lkey)
> > >  	cmd->lkey = lkey;
> > >  	cmd->rsvd_frmr = fr_mr ? 1 : 0;
> > >  	status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd);
> > > -	if (status)
> > > -		goto mbx_err;
> > > -mbx_err:
> > > +
> >
> > Can you please remove assignment from "int status = -ENOMEM"?
> > It produces warning too.
> >
>
> OK. Will do.
>
> By the way, which compiler triggers that warning?

Honestly, I don't remember, one of my building bots complained about it.

Thanks

>
> I'm using GCC 7.2.0 and I don't see it.
>
> Thanks
> --
> Gustavo A. R. Silva
>
>
>
>
>
diff mbox

Patch

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index f8c14c7..db02bbb 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -1956,9 +1956,7 @@  int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev *dev, int fr_mr, u32 lkey)
 	cmd->lkey = lkey;
 	cmd->rsvd_frmr = fr_mr ? 1 : 0;
 	status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd);
-	if (status)
-		goto mbx_err;
-mbx_err:
+
 	kfree(cmd);
 	return status;
 }