Skip to contentSkip to conversation

drivers/misc/xlink-pcie/local_host/mxlk_epf.c:478:6: warning: Variable 'ret' is reassigned a value before the old one has been used.

PATCH New Dan Carpenter 1 participant 1 message Sep 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 414/1142 drivers/misc/xlink-pcie/local_host/mxlk_epf.c:478:6: warning: Variable 'ret' is reassigned a value before the old one has been used.

tree:   https://github.com/intel/linux-intel-lts.git  5.4/yocto
head:   eeb611e5394c56d45c5cc8f7dc484c9f19e93143
commit: 792c8003efc4d75b5f52db70e7380b6a425bdba8 [414/1142] xlink-pcie: XLink PCIe Remote and Local Host driver
compiler: ia64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate

cppcheck warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

drivers/misc/xlink-pcie/local_host/mxlk_epf.c:478:6: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]

    ret = pci_epf_register_driver(&mxlk_pcie_epf_driver);
        ^
   drivers/misc/xlink-pcie/local_host/mxlk_epf.c:476:0: note: Variable 'ret' is reassigned a value before the old one has been used.
    int ret = -EBUSY;
   ^
   drivers/misc/xlink-pcie/local_host/mxlk_epf.c:478:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret = pci_epf_register_driver(&mxlk_pcie_epf_driver);
        ^

# https://github.com/intel/linux-intel-lts/commit/792c8003efc4d75b5f52db70e7380b6a425bdba8
git remote add intel-linux-intel-lts https://github.com/intel/linux-intel-lts.git
git fetch --no-tags intel-linux-intel-lts 5.4/yocto
git checkout 792c8003efc4d75b5f52db70e7380b6a425bdba8
vim +/ret +478 drivers/misc/xlink-pcie/local_host/mxlk_epf.c

792c8003efc4d75 Xin Zhang 2020-07-07  474  static int __init mxlk_epf_init(void)
792c8003efc4d75 Xin Zhang 2020-07-07  475  {
792c8003efc4d75 Xin Zhang 2020-07-07  476  	int ret = -EBUSY;
                                                    ^^^^^^^^^^^^^

Assignment is never used.

792c8003efc4d75 Xin Zhang 2020-07-07 477

792c8003efc4d75 Xin Zhang 2020-07-07 @478  	ret = pci_epf_register_driver(&mxlk_pcie_epf_driver);
                                                ^^^^^^
792c8003efc4d75 Xin Zhang 2020-07-07  479  	if (ret) {
792c8003efc4d75 Xin Zhang 2020-07-07  480  		pr_err("Failed to register xlink pcie epf driver: %d\n", ret);
792c8003efc4d75 Xin Zhang 2020-07-07  481  		return ret;
792c8003efc4d75 Xin Zhang 2020-07-07  482  	}
792c8003efc4d75 Xin Zhang 2020-07-07  483  
792c8003efc4d75 Xin Zhang 2020-07-07  484  	return 0;
792c8003efc4d75 Xin Zhang 2020-07-07  485  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org