mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH linux-next] e1000e: Remove useless variables
@ 2021-11-11  9:07 cgel.zte
  2021-11-18  0:06 ` Nguyen, Anthony L
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-11-11  9:07 UTC (permalink / raw)
  To: Jesse Brandeburg
  Cc: Tony Nguyen, David S . Miller, Jakub Kicinski, intel-wired-lan,
	netdev, linux-kernel, luo penghao, Zeal Robot

From: luo penghao <luo.penghao@zte.com.cn>

This variable is not used in the function.

The clang_analyzer complains as follows:

drivers/net/ethernet/intel/e1000e/netdev.c:916:19 warning
drivers/net/ethernet/intel/e1000e/netdev.c:1310:19 warning

Value stored to 'hw' during its initialization is never read

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: luo penghao <luo.penghao@zte.com.cn>
---
 drivers/net/ethernet/intel/e1000e/netdev.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index ebcb2a3..8a79681 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -914,7 +914,6 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done,
 	struct e1000_adapter *adapter = rx_ring->adapter;
 	struct net_device *netdev = adapter->netdev;
 	struct pci_dev *pdev = adapter->pdev;
-	struct e1000_hw *hw = &adapter->hw;
 	union e1000_rx_desc_extended *rx_desc, *next_rxd;
 	struct e1000_buffer *buffer_info, *next_buffer;
 	u32 length, staterr;
@@ -1308,7 +1307,6 @@ static bool e1000_clean_rx_irq_ps(struct e1000_ring *rx_ring, int *work_done,
 				  int work_to_do)
 {
 	struct e1000_adapter *adapter = rx_ring->adapter;
-	struct e1000_hw *hw = &adapter->hw;
 	union e1000_rx_desc_packet_split *rx_desc, *next_rxd;
 	struct net_device *netdev = adapter->netdev;
 	struct pci_dev *pdev = adapter->pdev;
-- 
2.15.2



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

* Re: [PATCH linux-next] e1000e: Remove useless variables
  2021-11-11  9:07 [PATCH linux-next] e1000e: Remove useless variables cgel.zte
@ 2021-11-18  0:06 ` Nguyen, Anthony L
  0 siblings, 0 replies; 2+ messages in thread
From: Nguyen, Anthony L @ 2021-11-18  0:06 UTC (permalink / raw)
  To: cgel.zte, Brandeburg, Jesse
  Cc: luo.penghao, zealci, linux-kernel, davem, kuba, intel-wired-lan, netdev

On Thu, 2021-11-11 at 09:07 +0000, cgel.zte@gmail.com wrote:
> From: luo penghao <luo.penghao@zte.com.cn>
> 
> This variable is not used in the function.
> 
> The clang_analyzer complains as follows:
> 
> drivers/net/ethernet/intel/e1000e/netdev.c:916:19 warning
> drivers/net/ethernet/intel/e1000e/netdev.c:1310:19 warning
> 
> Value stored to 'hw' during its initialization is never read

This patch also doesn't build:

In file included from ./include/linux/printk.h:555,
                 from ./include/linux/kernel.h:20,
                 from ./arch/x86/include/asm/percpu.h:27,
                 from ./arch/x86/include/asm/current.h:6,
                 from ./arch/x86/include/asm/processor.h:17,
                 from ./arch/x86/include/asm/timex.h:5,
                 from ./include/linux/timex.h:65,
                 from ./include/linux/time32.h:13,
                 from ./include/linux/time.h:60,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:13,
                 from drivers/net/ethernet/intel/e1000e/netdev.c:6:
drivers/net/ethernet/intel/e1000e/netdev.c: In function
e1000_clean_rx_irq:
drivers/net/ethernet/intel/e1000e/e1000.h:31:20: error: hw undeclared
(first use in this function)
   31 |         netdev_dbg(hw->adapter->netdev, format, ## arg)
      |                    ^~
./include/linux/dynamic_debug.h:134:29: note: in definition of macro
__dynamic_func_call
  134 |                 func(&id, ##__VA_ARGS__);               \
      |                             ^~~~~~~~~~~
./include/linux/dynamic_debug.h:170:9: note: in expansion of macro
_dynamic_func_call
  170 |         _dynamic_func_call(fmt, __dynamic_netdev_dbg,         
\
      |         ^~~~~~~~~~~~~~~~~~
./include/linux/netdevice.h:4950:9: note: in expansion of macro
dynamic_netdev_dbg
 4950 |         dynamic_netdev_dbg(__dev, format, ##args);            
\
      |         ^~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/e1000e/e1000.h:31:9: note: in expansion of
macro netdev_dbg
   31 |         netdev_dbg(hw->adapter->netdev, format, ## arg)
      |         ^~~~~~~~~~
drivers/net/ethernet/intel/e1000e/netdev.c:970:25: note: in expansion
of macro e_dbg
  970 |                         e_dbg("Receive packet consumed multiple
buffers\n");
      |                         ^~~~~
drivers/net/ethernet/intel/e1000e/e1000.h:31:20: note: each undeclared
identifier is reported only once for each function it appears in
   31 |         netdev_dbg(hw->adapter->netdev, format, ## arg)
      |                    ^~
./include/linux/dynamic_debug.h:134:29: note: in definition of macro
__dynamic_func_call
  134 |                 func(&id, ##__VA_ARGS__);               \
      |                             ^~~~~~~~~~~
./include/linux/dynamic_debug.h:170:9: note: in expansion of macro
_dynamic_func_call
  170 |         _dynamic_func_call(fmt, __dynamic_netdev_dbg,         
\
      |         ^~~~~~~~~~~~~~~~~~
./include/linux/netdevice.h:4950:9: note: in expansion of macro
dynamic_netdev_dbg
 4950 |         dynamic_netdev_dbg(__dev, format, ##args);            
\
      |         ^~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/e1000e/e1000.h:31:9: note: in expansion of
macro netdev_dbg
   31 |         netdev_dbg(hw->adapter->netdev, format, ## arg)
      |         ^~~~~~~~~~
drivers/net/ethernet/intel/e1000e/netdev.c:970:25: note: in expansion
of macro e_dbg
  970 |                         e_dbg("Receive packet consumed multiple
buffers\n");
      |                         ^~~~~
drivers/net/ethernet/intel/e1000e/netdev.c: In function
e1000_clean_rx_irq_ps:
drivers/net/ethernet/intel/e1000e/e1000.h:31:20: error: hw undeclared
(first use in this function)
   31 |         netdev_dbg(hw->adapter->netdev, format, ## arg)
      |                    ^~
./include/linux/dynamic_debug.h:134:29: note: in definition of macro
__dynamic_func_call
  134 |                 func(&id, ##__VA_ARGS__);               \
      |                             ^~~~~~~~~~~
./include/linux/dynamic_debug.h:170:9: note: in expansion of macro
_dynamic_func_call
  170 |         _dynamic_func_call(fmt, __dynamic_netdev_dbg,         
\
      |         ^~~~~~~~~~~~~~~~~~
./include/linux/netdevice.h:4950:9: note: in expansion of macro
dynamic_netdev_dbg
 4950 |         dynamic_netdev_dbg(__dev, format, ##args);            
\
      |         ^~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/e1000e/e1000.h:31:9: note: in expansion of
macro netdev_dbg
   31 |         netdev_dbg(hw->adapter->netdev, format, ## arg)
      |         ^~~~~~~~~~
drivers/net/ethernet/intel/e1000e/netdev.c:1356:25: note: in expansion
of macro e_dbg
 1356 |                         e_dbg("Packet Split buffers didn't pick
up the full packet\n");
      |                         ^~~~~



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

end of thread, other threads:[~2021-11-18  0:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11  9:07 [PATCH linux-next] e1000e: Remove useless variables cgel.zte
2021-11-18  0:06 ` Nguyen, Anthony L

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®