kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] lan743x: remove redundant initialization of variable current_head_index
@ 2020-07-22 15:12 Colin King
  2020-07-23  0:55 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-07-22 15:12 UTC (permalink / raw)
  To: Bryan Whitehead, Microchip Linux Driver Support,
	David S . Miller, Jakub Kicinski, netdev
  Cc: kernel-janitors, linux-kernel

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

The variable current_head_index is being initialized with a value that
is never read and it is being updated later with a new value.  Replace
the initialization of -1 with the latter assignment.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/microchip/lan743x_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index f6479384dc4f..de93cc6ebc1a 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -2046,14 +2046,13 @@ static int lan743x_rx_process_packet(struct lan743x_rx *rx)
 {
 	struct skb_shared_hwtstamps *hwtstamps = NULL;
 	int result = RX_PROCESS_RESULT_NOTHING_TO_DO;
+	int current_head_index = *rx->head_cpu_ptr;
 	struct lan743x_rx_buffer_info *buffer_info;
 	struct lan743x_rx_descriptor *descriptor;
-	int current_head_index = -1;
 	int extension_index = -1;
 	int first_index = -1;
 	int last_index = -1;
 
-	current_head_index = *rx->head_cpu_ptr;
 	if (current_head_index < 0 || current_head_index >= rx->ring_size)
 		goto done;
 
-- 
2.27.0

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

* Re: [PATCH][next] lan743x: remove redundant initialization of variable current_head_index
  2020-07-22 15:12 [PATCH][next] lan743x: remove redundant initialization of variable current_head_index Colin King
@ 2020-07-23  0:55 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-07-23  0:55 UTC (permalink / raw)
  To: colin.king
  Cc: bryan.whitehead, UNGLinuxDriver, kuba, netdev, kernel-janitors,
	linux-kernel

From: Colin King <colin.king@canonical.com>
Date: Wed, 22 Jul 2020 16:12:21 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable current_head_index is being initialized with a value that
> is never read and it is being updated later with a new value.  Replace
> the initialization of -1 with the latter assignment.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thank you.

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

end of thread, other threads:[~2020-07-23  0:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 15:12 [PATCH][next] lan743x: remove redundant initialization of variable current_head_index Colin King
2020-07-23  0:55 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).