2017-11-07 23:13:23

by Gustavo A. R. Silva

[permalink] [raw]
Subject: [PATCH v2] IB/ocrdma_hw: remove unnecessary code in ocrdma_mbx_dealloc_lkey

Check on return value and goto label mbx_err are unnecessary.

Addresses-Coverity-ID: 1268780
Signed-off-by: Gustavo A. R. Silva <[email protected]>
Reviewed-by: Yuval Shaia <[email protected]>
---
Changes in v2:
Remove assignment from "int status = -ENOMEM" as suggested by Leon Romanovsky.

drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index f8c14c7..0ba695a 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -1947,7 +1947,7 @@ int ocrdma_mbx_alloc_lkey(struct ocrdma_dev *dev, struct ocrdma_hw_mr *hwmr,

int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev *dev, int fr_mr, u32 lkey)
{
- int status = -ENOMEM;
+ int status;
struct ocrdma_dealloc_lkey *cmd;

cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_DEALLOC_LKEY, sizeof(*cmd));
@@ -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;
}
--
2.7.4


From 1583450495198327157@xxx Tue Nov 07 23:07:48 +0000 2017
X-GM-THRID: 1583327717666520187
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread


2017-11-07 14:58:49

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH v2] IB/ocrdma_hw: remove unnecessary code in ocrdma_mbx_dealloc_lkey


Quoting Leon Romanovsky <[email protected]>:

> On Tue, Nov 07, 2017 at 08:45:17AM -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 <[email protected]>
>> Reviewed-by: Yuval Shaia <[email protected]>
>> ---
>> Changes in v2:
>> Remove assignment from "int status = -ENOMEM" as suggested by Leon
>> Romanovsky.
>>
>> drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 6 ++----
>> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> Please use git send-email to send patches and not reply to the conversation.
>

I'm using mutt.
What would be the advantage of using git send-email in this case?

> Thanks,
> Reviewed-by: Leon Romanovsky <[email protected]>

Thank you
--
Gustavo A. R. Silva






From 1583419345627806482@xxx Tue Nov 07 14:52:42 +0000 2017
X-GM-THRID: 1583327717666520187
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread

2017-11-07 14:52:42

by Leon Romanovsky

[permalink] [raw]
Subject: Re: [PATCH v2] IB/ocrdma_hw: remove unnecessary code in ocrdma_mbx_dealloc_lkey

On Tue, Nov 07, 2017 at 08:45:17AM -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 <[email protected]>
> Reviewed-by: Yuval Shaia <[email protected]>
> ---
> Changes in v2:
> Remove assignment from "int status = -ENOMEM" as suggested by Leon Romanovsky.
>
> drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)

Please use git send-email to send patches and not reply to the conversation.

Thanks,
Reviewed-by: Leon Romanovsky <[email protected]>


Attachments:
(No filename) (651.00 B)
signature.asc (849.00 B)
Download all attachments