diff mbox series

[linux] e1000e: Delete redundant variable definitions

Message ID 20211111090555.158828-1-luo.penghao@zte.com.cn (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [linux] e1000e: Delete redundant variable definitions | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 2 this patch: 8
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang fail Errors and warnings before: 22 this patch: 9
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 6 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

CGEL Nov. 11, 2021, 9:05 a.m. UTC
From: luo penghao <luo.penghao@zte.com.cn>

The local variable is not used elsewhere in the function

The clang_analyzer complains as follows:

drivers/net/ethernet/intel/e1000e/ptp.c:241: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/ptp.c | 1 -
 1 file changed, 1 deletion(-)

Comments

kernel test robot Nov. 11, 2021, 2:56 p.m. UTC | #1
Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux/master]

url:    https://github.com/0day-ci/linux/commits/cgel-zte-gmail-com/e1000e-Delete-redundant-variable-definitions/20211111-170640
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git debe436e77c72fcee804fb867f275e6d31aa999c
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/81faea6b288a1c17c390413bcb3021fef7e89bad
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review cgel-zte-gmail-com/e1000e-Delete-redundant-variable-definitions/20211111-170640
        git checkout 81faea6b288a1c17c390413bcb3021fef7e89bad
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/printk.h:555,
                    from include/asm-generic/bug.h:22,
                    from arch/arc/include/asm/bug.h:30,
                    from include/linux/ktime.h:26,
                    from include/linux/timer.h:6,
                    from drivers/net/ethernet/intel/e1000e/e1000.h:11,
                    from drivers/net/ethernet/intel/e1000e/ptp.c:9:
   drivers/net/ethernet/intel/e1000e/ptp.c: In function 'e1000e_systim_overflow_work':
>> 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:5324:9: note: in expansion of macro 'dynamic_netdev_dbg'
    5324 |         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/ptp.c:248:9: note: in expansion of macro 'e_dbg'
     248 |         e_dbg("SYSTIM overflow check at %lld.%09lu\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:5324:9: note: in expansion of macro 'dynamic_netdev_dbg'
    5324 |         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/ptp.c:248:9: note: in expansion of macro 'e_dbg'
     248 |         e_dbg("SYSTIM overflow check at %lld.%09lu\n",
         |         ^~~~~


vim +/hw +31 drivers/net/ethernet/intel/e1000e/e1000.h

bc7f75fa97884d drivers/net/e1000e/e1000.h Auke Kok     2007-09-17  29  
44defeb3f6f98e drivers/net/e1000e/e1000.h Jeff Kirsher 2008-08-04  30  #define e_dbg(format, arg...) \
8544b9f7371ec6 drivers/net/e1000e/e1000.h Bruce Allan  2010-03-24 @31  	netdev_dbg(hw->adapter->netdev, format, ## arg)
44defeb3f6f98e drivers/net/e1000e/e1000.h Jeff Kirsher 2008-08-04  32  #define e_err(format, arg...) \
8544b9f7371ec6 drivers/net/e1000e/e1000.h Bruce Allan  2010-03-24  33  	netdev_err(adapter->netdev, format, ## arg)
44defeb3f6f98e drivers/net/e1000e/e1000.h Jeff Kirsher 2008-08-04  34  #define e_info(format, arg...) \
8544b9f7371ec6 drivers/net/e1000e/e1000.h Bruce Allan  2010-03-24  35  	netdev_info(adapter->netdev, format, ## arg)
44defeb3f6f98e drivers/net/e1000e/e1000.h Jeff Kirsher 2008-08-04  36  #define e_warn(format, arg...) \
8544b9f7371ec6 drivers/net/e1000e/e1000.h Bruce Allan  2010-03-24  37  	netdev_warn(adapter->netdev, format, ## arg)
44defeb3f6f98e drivers/net/e1000e/e1000.h Jeff Kirsher 2008-08-04  38  #define e_notice(format, arg...) \
8544b9f7371ec6 drivers/net/e1000e/e1000.h Bruce Allan  2010-03-24  39  	netdev_notice(adapter->netdev, format, ## arg)
bc7f75fa97884d drivers/net/e1000e/e1000.h Auke Kok     2007-09-17  40  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Jakub Kicinski Nov. 11, 2021, 4:50 p.m. UTC | #2
On Thu, 11 Nov 2021 22:56:38 +0800 kernel test robot wrote:
> >> 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)

Yeah, the infinite wisdom of Intel drivers using macros with implicit
arguments :/

You should build test your patches, tho.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/e1000e/ptp.c b/drivers/net/ethernet/intel/e1000e/ptp.c
index eb5c014..e6dcac9 100644
--- a/drivers/net/ethernet/intel/e1000e/ptp.c
+++ b/drivers/net/ethernet/intel/e1000e/ptp.c
@@ -238,7 +238,6 @@  static void e1000e_systim_overflow_work(struct work_struct *work)
 {
 	struct e1000_adapter *adapter = container_of(work, struct e1000_adapter,
 						     systim_overflow_work.work);
-	struct e1000_hw *hw = &adapter->hw;
 	struct timespec64 ts;
 	u64 ns;