Skip to contentSkip to conversation

IB/ocrdma_hw: remove unnecessary code in ocrdma_mbx_dealloc_lkey

PATCH Superseded Gustavo A. R. Silva 4 participants 13 messages Nov 6, 2017 – Nov 13, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +1 -3
index f8c14c7..db02bbb 100644
@@ -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;
 }
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Gustavo A. R. Silva

Check on return value and goto label mbx_err are unnecessary.

Addresses-Coverity-ID: 1268780

What's that?

Quoted 10 lines
---
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +0 -0
index f8c14c7..db02bbb 100644

drivers/infiniband/hw/ocrdma/ocrdma_hw.c int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev *dev, int fr_mr, u32 lkey) · line 1961

Quoted 9 lines
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +1 -3
@@ -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;
Quoted 8 lines
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +0 -0
 }
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi Yuval,

Quoting Yuval Shaia <[email protected]>:

Quoted 7 lines · Gustavo A. R. Silva
Quoted 3 lines

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.

Quoted 13 lines
Quoted 13 lines
---
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +0 -0
index f8c14c7..db02bbb 100644
@@ -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);
Quoted 9 lines

drivers/infiniband/hw/ocrdma/ocrdma_hw.c int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev *dev, int fr_mr, u32 lkey) · line 1961

Quoted 6 lines
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +1 -3
-	if (status)
-		goto mbx_err;
-mbx_err:
+
 	kfree(cmd);
 	return status;

Thank you
--
Gustavo A. R. Silva

#3 lore raw
In reply to Gustavo A. R. Silva
Quoted 13 lines · Gustavo A. R. Silva

Check on return value and goto label mbx_err are unnecessary.

Addresses-Coverity-ID: 1268780

---
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +0 -0
index f8c14c7..db02bbb 100644

drivers/infiniband/hw/ocrdma/ocrdma_hw.c int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev *dev, int fr_mr, u32 lkey) · line 1959

Quoted 7 lines
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +1 -3
@@ -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

Quoted 6 lines
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +0 -1
 	kfree(cmd);
 	return status;
 }
--

2.7.4

#4 lore raw

Hi Leon,

Quoting Leon Romanovsky <[email protected]>:

Quoted 9 lines · Gustavo A. R. Silva
Quoted 8 lines

Check on return value and goto label mbx_err are unnecessary.

Addresses-Coverity-ID: 1268780

---
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Quoted 17 lines

drivers/infiniband/hw/ocrdma/ocrdma_hw.c int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev · line 1960

Quoted 13 lines
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +1 -3
index f8c14c7..db02bbb 100644
@@ -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

#5 lore raw
Quoted 32 lines · Gustavo A. R. Silva

Hi Leon,

Quoting Leon Romanovsky <[email protected]>:

Quoted 18 lines · Gustavo A. R. Silva
Quoted 17 lines

Check on return value and goto label mbx_err are unnecessary.

Addresses-Coverity-ID: 1268780

---
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +0 -0
index f8c14c7..db02bbb 100644
@@ -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;
Quoted 9 lines

drivers/infiniband/hw/ocrdma/ocrdma_hw.c int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev *dev, int fr_mr, u32 lkey) · line 1959

Quoted 5 lines
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +1 -3
 	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.

Quoted 3 lines

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

Quoted 11 lines

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

Thanks
--
Gustavo A. R. Silva

#6 lore raw

PATCH v2 1/1 IB/ocrdma_hw: remove unnecessary code in ocrdma_mbx_dealloc_lkey

In reply to Gustavo A. R. Silva

Check on return value and goto label mbx_err are unnecessary.

Addresses-Coverity-ID: 1268780

---
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(-)
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +2 -4
index f8c14c7..0ba695a 100644
@@ -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;
 }
Signature · 1 line
2.7.4
Reviewed-by on v2 1/1
#7 lore raw
Quoted 11 lines · Gustavo A. R. Silva

Check on return value and goto label mbx_err are unnecessary.

Addresses-Coverity-ID: 1268780

---
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,

#8 lore raw

Quoting Leon Romanovsky <[email protected]>:

Quoted 11 lines · Gustavo A. R. Silva
Quoted 10 lines

Check on return value and goto label mbx_err are unnecessary.

Addresses-Coverity-ID: 1268780

---
Changes in v2:
Remove assignment from "int status = -ENOMEM" as suggested by Leon
Romanovsky.

Quoted 5 lines
Quoted 2 lines
 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?

Quoted 2 lines

Thanks,

Thank you
--
Gustavo A. R. Silva

#9 lore raw
Quoted 14 lines · Gustavo A. R. Silva

Quoting Leon Romanovsky <[email protected]>:

Quoted 11 lines · Gustavo A. R. Silva
Quoted 10 lines

Check on return value and goto label mbx_err are unnecessary.

Addresses-Coverity-ID: 1268780

---
Changes in v2:
Remove assignment from "int status = -ENOMEM" as suggested by Leon
Romanovsky.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
 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?

New mail headers, so it won't appear as Reply-To and will be presented correctly in mutt's threaded mode.

You can do it with mutt too.

Quoted 12 lines
Quoted 3 lines

Thanks,

Thank you
--
Gustavo A. R. Silva

#10 lore raw

Quoting Leon Romanovsky <[email protected]>:

Quoted 19 lines · Gustavo A. R. Silva
Quoted 18 lines

Quoting Leon Romanovsky <[email protected]>:

Quoted 15 lines · Gustavo A. R. Silva
Quoted 5 lines

Check on return value and goto label mbx_err are unnecessary.

Addresses-Coverity-ID: 1268780

Quoted 7 lines

---
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

Quoted 9 lines
Quoted 5 lines

conversation.

Quoted 1 line

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

New mail headers, so it won't appear as Reply-To and will be presented correctly in mutt's threaded mode.

Oh I actually did that on purpose.

So the preferred way to do this is to send the vN of the patch as a reply to the first patch? or as a new thread?

Thanks
--
Gustavo A. R. Silva

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
Quoted 32 lines · Gustavo A. R. Silva

Quoting Leon Romanovsky <[email protected]>:

Quoted 19 lines · Gustavo A. R. Silva
Quoted 18 lines

Quoting Leon Romanovsky <[email protected]>:

Quoted 15 lines · Gustavo A. R. Silva
Quoted 5 lines

Check on return value and goto label mbx_err are unnecessary.

Addresses-Coverity-ID: 1268780

Quoted 7 lines

---
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

Quoted 9 lines
Quoted 5 lines

conversation.

Quoted 1 line

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

New mail headers, so it won't appear as Reply-To and will be presented correctly in mutt's threaded mode.

Quoted 5 lines

Oh I actually did that on purpose.

So the preferred way to do this is to send the vN of the patch as a reply to the first patch?
or as a new thread?

As a new thread, please. It gives numerous advantages: nice view in mutt, easy followed links in web archives and maintainer's acceptance email as a response to actual vN patch and not to initial patch.

Thanks

Quoted 13 lines

Thanks
--
Gustavo A. R. Silva

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html