All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cnic: remove redundant assignment to variable ret
@ 2020-05-08 22:40 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2020-05-08 22:40 UTC (permalink / raw)
  To: David S . Miller, netdev; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The variable ret is being assigned with a value that is never read,
the assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/broadcom/cnic.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index 61ab7d21f6bd..c5cca63b8571 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -1918,7 +1918,6 @@ static int cnic_bnx2x_iscsi_ofld1(struct cnic_dev *dev, struct kwqe *wqes[],
 	ret = cnic_alloc_bnx2x_conn_resc(dev, l5_cid);
 	if (ret) {
 		atomic_dec(&cp->iscsi_conn);
-		ret = 0;
 		goto done;
 	}
 	ret = cnic_setup_bnx2x_ctx(dev, wqes, num);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] cnic: remove redundant assignment to variable ret
@ 2020-05-08 22:40 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2020-05-08 22:40 UTC (permalink / raw)
  To: David S . Miller, netdev; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The variable ret is being assigned with a value that is never read,
the assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/broadcom/cnic.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index 61ab7d21f6bd..c5cca63b8571 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -1918,7 +1918,6 @@ static int cnic_bnx2x_iscsi_ofld1(struct cnic_dev *dev, struct kwqe *wqes[],
 	ret = cnic_alloc_bnx2x_conn_resc(dev, l5_cid);
 	if (ret) {
 		atomic_dec(&cp->iscsi_conn);
-		ret = 0;
 		goto done;
 	}
 	ret = cnic_setup_bnx2x_ctx(dev, wqes, num);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] cnic: remove redundant assignment to variable ret
  2020-05-08 22:40 ` Colin King
@ 2020-05-09  4:50   ` Michael Chan
  -1 siblings, 0 replies; 8+ messages in thread
From: Michael Chan @ 2020-05-09  4:50 UTC (permalink / raw)
  To: Colin King; +Cc: David S . Miller, Netdev, kernel-janitors, open list

On Fri, May 8, 2020 at 3:40 PM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable ret is being assigned with a value that is never read,
> the assignment is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Michael Chan <michael.chan@broadcom.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cnic: remove redundant assignment to variable ret
@ 2020-05-09  4:50   ` Michael Chan
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Chan @ 2020-05-09  4:50 UTC (permalink / raw)
  To: Colin King; +Cc: David S . Miller, Netdev, kernel-janitors, open list

On Fri, May 8, 2020 at 3:40 PM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable ret is being assigned with a value that is never read,
> the assignment is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Michael Chan <michael.chan@broadcom.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cnic: remove redundant assignment to variable ret
  2020-05-08 22:40 ` Colin King
@ 2020-05-09  5:48   ` Jakub Kicinski
  -1 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2020-05-09  5:48 UTC (permalink / raw)
  To: Colin King; +Cc: David S . Miller, netdev, kernel-janitors, linux-kernel

On Fri,  8 May 2020 23:40:26 +0100 Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable ret is being assigned with a value that is never read,
> the assignment is redundant and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thank you!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cnic: remove redundant assignment to variable ret
@ 2020-05-09  5:48   ` Jakub Kicinski
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2020-05-09  5:48 UTC (permalink / raw)
  To: Colin King; +Cc: David S . Miller, netdev, kernel-janitors, linux-kernel

On Fri,  8 May 2020 23:40:26 +0100 Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable ret is being assigned with a value that is never read,
> the assignment is redundant and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thank you!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cnic: remove redundant assignment to variable ret
  2020-05-08 22:40 ` Colin King
@ 2020-05-09 10:51   ` Dan Carpenter
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2020-05-09 10:51 UTC (permalink / raw)
  To: Colin King; +Cc: David S . Miller, netdev, kernel-janitors, linux-kernel

On Fri, May 08, 2020 at 11:40:26PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable ret is being assigned with a value that is never read,
> the assignment is redundant and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

We used to return negative error codes until commit 23021c21055f ("cnic:
Improve error recovery on bnx2x devices").

To be honest, I like the deliberate "ret = 0;" because this code will
trigger a static checker warning about wrong error codes.  Also it looks
wrong to human reviewers.  We should probably add a comment:

	/* Deliberately returning success */
	return 0;

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cnic: remove redundant assignment to variable ret
@ 2020-05-09 10:51   ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2020-05-09 10:51 UTC (permalink / raw)
  To: Colin King; +Cc: David S . Miller, netdev, kernel-janitors, linux-kernel

On Fri, May 08, 2020 at 11:40:26PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable ret is being assigned with a value that is never read,
> the assignment is redundant and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

We used to return negative error codes until commit 23021c21055f ("cnic:
Improve error recovery on bnx2x devices").

To be honest, I like the deliberate "ret = 0;" because this code will
trigger a static checker warning about wrong error codes.  Also it looks
wrong to human reviewers.  We should probably add a comment:

	/* Deliberately returning success */
	return 0;

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-05-09 10:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 22:40 [PATCH] cnic: remove redundant assignment to variable ret Colin King
2020-05-08 22:40 ` Colin King
2020-05-09  4:50 ` Michael Chan
2020-05-09  4:50   ` Michael Chan
2020-05-09  5:48 ` Jakub Kicinski
2020-05-09  5:48   ` Jakub Kicinski
2020-05-09 10:51 ` Dan Carpenter
2020-05-09 10:51   ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.