All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/net/ethernet/asix/ax88796c_main.c:548:21: warning: Value stored to 'ndev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-05-06  5:03 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-05-06  5:03 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 17376 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: "Łukasz Stelmach" <l.stelmach@samsung.com>
CC: Jakub Kicinski <kuba@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fe27d189e3f42e31d3c8223d5daed7285e334c5e
commit: a97c69ba4f30e46abb9cc7be8b98227cb468fdf9 net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver
date:   7 months ago
:::::: branch date: 5 hours ago
:::::: commit date: 7 months ago
config: riscv-randconfig-c006-20220427 (https://download.01.org/0day-ci/archive/20220506/202205061245.gtVhHpI4-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 1cddcfdc3c683b393df1a5c9063252eb60e52818)
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
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a97c69ba4f30e46abb9cc7be8b98227cb468fdf9
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout a97c69ba4f30e46abb9cc7be8b98227cb468fdf9
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
                                                                             ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:455:2: note: Assuming the condition is false
           brcmf_err("fail!\n");
           ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h:49:7: note: expanded from macro 'brcmf_err'
                       net_ratelimit())                                    \
                       ^~~~~~~~~~~~~~~
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:455:2: note: Taking false branch
           brcmf_err("fail!\n");
           ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h:47:3: note: expanded from macro 'brcmf_err'
                   if (IS_ENABLED(CONFIG_BRCMDBG) ||                       \
                   ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:455:2: note: Loop condition is false.  Exiting loop
           brcmf_err("fail!\n");
           ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h:46:2: note: expanded from macro 'brcmf_err'
           do {                                                            \
           ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:456:2: note: Loop condition is true.  Entering loop body
           while (!list_empty(q)) {
           ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:457:9: note: Left side of '&&' is false
                   req = list_entry(q->next, struct brcmf_usbreq, list);
                         ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:457:9: note: Taking false branch
                   req = list_entry(q->next, struct brcmf_usbreq, list);
                         ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:457:9: note: Loop condition is false.  Exiting loop
                   req = list_entry(q->next, struct brcmf_usbreq, list);
                         ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:458:7: note: Assuming 'req' is null
                   if (req)
                       ^~~
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:458:3: note: Taking false branch
                   if (req)
                   ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:460:12: note: Passing null pointer value via 1st parameter 'entry'
                   list_del(q->next);
                            ^~~~~~~
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:460:3: note: Calling 'list_del'
                   list_del(q->next);
                   ^~~~~~~~~~~~~~~~~
   include/linux/list.h:146:19: note: Passing null pointer value via 1st parameter 'entry'
           __list_del_entry(entry);
                            ^~~~~
   include/linux/list.h:146:2: note: Calling '__list_del_entry'
           __list_del_entry(entry);
           ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:132:2: note: Taking false branch
           if (!__list_del_entry_valid(entry))
           ^
   include/linux/list.h:135:13: note: Access to field 'prev' results in a dereference of a null pointer (loaded from variable 'entry')
           __list_del(entry->prev, entry->next);
                      ^~~~~
   Suppressed 4 warnings (4 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
>> drivers/net/ethernet/asix/ax88796c_main.c:548:21: warning: Value stored to 'ndev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct net_device *ndev = ax_local->ndev;
                              ^~~~   ~~~~~~~~~~~~~~
   drivers/net/ethernet/asix/ax88796c_main.c:548:21: note: Value stored to 'ndev' during its initialization is never read
           struct net_device *ndev = ax_local->ndev;
                              ^~~~   ~~~~~~~~~~~~~~
   include/asm-generic/bitops/non-atomic.h:118:16: warning: Array access (from variable 'addr') results in a null pointer dereference [clang-analyzer-core.NullDereference]
           return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
                         ^
   drivers/net/ethernet/asix/ax88796c_main.c:801:6: note: Assuming 'ret' is 0
           if (ret) {
               ^~~
   drivers/net/ethernet/asix/ax88796c_main.c:801:2: note: Taking false branch
           if (ret) {
           ^
   drivers/net/ethernet/asix/ax88796c_main.c:810:6: note: Assuming 'ret' is >= 0
           if (ret < 0) {
               ^~~~~~~
   drivers/net/ethernet/asix/ax88796c_main.c:810:2: note: Taking false branch
           if (ret < 0) {
           ^
   drivers/net/ethernet/asix/ax88796c_main.c:851:6: note: Assuming the condition is false
           if (ax_local->phydev->advertising &&
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/asix/ax88796c_main.c:851:36: note: Left side of '&&' is false
           if (ax_local->phydev->advertising &&
                                             ^
   drivers/net/ethernet/asix/ax88796c_main.c:859:5: note: Passing null pointer value via 2nd parameter 'addr'
                                   ax_local->phydev->advertising) ? AX_FC_RX : 0;
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/asix/ax88796c_main.c:858:8: note: Calling 'linkmode_test_bit'
           fc |= linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/linkmode.h:76:22: note: Passing null pointer value via 2nd parameter 'addr'
           return test_bit(nr, addr);
                               ^~~~
   include/linux/linkmode.h:76:9: note: Calling 'arch_test_bit'
           return test_bit(nr, addr);
                  ^
   include/asm-generic/bitops/non-atomic.h:120:18: note: expanded from macro 'test_bit'
   #define test_bit arch_test_bit
                    ^
   include/asm-generic/bitops/non-atomic.h:118:16: note: Array access (from variable 'addr') results in a null pointer dereference
           return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
                         ^~~~
   Suppressed 5 warnings (4 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (4 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   10 warnings generated.
   drivers/net/ethernet/cadence/macb_main.c:1507:13: warning: Access to field 'addr' results in a dereference of a null pointer (loaded from variable 'desc') [clang-analyzer-core.NullDereference]
           desc->addr |= MACB_BIT(RX_WRAP);
                      ^
   drivers/net/ethernet/cadence/macb_main.c:2438:2: note: Calling 'macb_init_rx_ring'
           macb_init_rx_ring(&bp->queues[0]);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:1497:2: note: 'desc' initialized to a null pointer value
           struct macb_dma_desc *desc = NULL;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:1501:14: note: Assuming 'i' is >= field 'rx_ring_size'
           for (i = 0; i < bp->rx_ring_size; i++) {
                       ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:1501:2: note: Loop condition is false. Execution continues on line 1507
           for (i = 0; i < bp->rx_ring_size; i++) {
           ^
   drivers/net/ethernet/cadence/macb_main.c:1507:13: note: Access to field 'addr' results in a dereference of a null pointer (loaded from variable 'desc')
           desc->addr |= MACB_BIT(RX_WRAP);
           ~~~~       ^
   drivers/net/ethernet/cadence/macb_main.c:2421:14: warning: Access to field 'ctrl' results in a dereference of a null pointer (loaded from variable 'desc') [clang-analyzer-core.NullDereference]
                   desc->ctrl |= MACB_BIT(TX_WRAP);
                   ~~~~       ^
   drivers/net/ethernet/cadence/macb_main.c:2411:2: note: 'desc' initialized to a null pointer value
           struct macb_dma_desc *desc = NULL;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:2415:34: note: Assuming 'q' is < field 'num_queues'
           for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
                                           ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:2415:2: note: Loop condition is true.  Entering loop body
           for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
           ^
   drivers/net/ethernet/cadence/macb_main.c:2416:15: note: Assuming 'i' is >= field 'tx_ring_size'
                   for (i = 0; i < bp->tx_ring_size; i++) {
                               ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:2416:3: note: Loop condition is false. Execution continues on line 2421
                   for (i = 0; i < bp->tx_ring_size; i++) {
                   ^
   drivers/net/ethernet/cadence/macb_main.c:2421:14: note: Access to field 'ctrl' results in a dereference of a null pointer (loaded from variable 'desc')
                   desc->ctrl |= MACB_BIT(TX_WRAP);
                   ~~~~       ^
   drivers/net/ethernet/cadence/macb_main.c:2447:13: warning: Access to field 'ctrl' results in a dereference of a null pointer (loaded from variable 'desc') [clang-analyzer-core.NullDereference]
           desc->ctrl |= MACB_BIT(TX_WRAP);
           ~~~~       ^
   drivers/net/ethernet/cadence/macb_main.c:2436:2: note: 'desc' initialized to a null pointer value
           struct macb_dma_desc *desc = NULL;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:2440:14: note: Assuming 'i' is >= field 'tx_ring_size'
           for (i = 0; i < bp->tx_ring_size; i++) {

vim +/ndev +548 drivers/net/ethernet/asix/ax88796c_main.c

a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  545  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  546  static int ax88796c_process_isr(struct ax88796c_device *ax_local)
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  547  {
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20 @548  	struct net_device *ndev = ax_local->ndev;
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  549  	int todo = 0;
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  550  	u16 isr;
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  551  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  552  	lockdep_assert_held(&ax_local->spi_lock);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  553  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  554  	isr = AX_READ(&ax_local->ax_spi, P0_ISR);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  555  	AX_WRITE(&ax_local->ax_spi, isr, P0_ISR);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  556  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  557  	netif_dbg(ax_local, intr, ndev, "  ISR 0x%04x\n", isr);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  558  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  559  	if (isr & ISR_TXERR) {
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  560  		netif_dbg(ax_local, intr, ndev, "  TXERR interrupt\n");
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  561  		AX_WRITE(&ax_local->ax_spi, TXNR_TXB_REINIT, P0_TSNR);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  562  		ax_local->seq_num = 0x1f;
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  563  	}
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  564  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  565  	if (isr & ISR_TXPAGES) {
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  566  		netif_dbg(ax_local, intr, ndev, "  TXPAGES interrupt\n");
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  567  		set_bit(EVENT_TX, &ax_local->flags);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  568  	}
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  569  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  570  	if (isr & ISR_LINK) {
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  571  		netif_dbg(ax_local, intr, ndev, "  Link change interrupt\n");
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  572  		phy_mac_interrupt(ax_local->ndev->phydev);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  573  	}
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  574  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  575  	if (isr & ISR_RXPKT) {
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  576  		netif_dbg(ax_local, intr, ndev, "  RX interrupt\n");
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  577  		todo = ax88796c_receive(ax_local->ndev);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  578  	}
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  579  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  580  	return todo;
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  581  }
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  582  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* drivers/net/ethernet/asix/ax88796c_main.c:548:21: warning: Value stored to 'ndev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-04-30  3:29 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-04-30  3:29 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 17020 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: "Łukasz Stelmach" <l.stelmach@samsung.com>
CC: Jakub Kicinski <kuba@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3e71713c9e75c34fc03f55ea86b381856ca952ee
commit: a97c69ba4f30e46abb9cc7be8b98227cb468fdf9 net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver
date:   6 months ago
:::::: branch date: 9 hours ago
:::::: commit date: 6 months ago
config: riscv-randconfig-c006-20220427 (https://download.01.org/0day-ci/archive/20220430/202204301152.40fCAFqi-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 1cddcfdc3c683b393df1a5c9063252eb60e52818)
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
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a97c69ba4f30e46abb9cc7be8b98227cb468fdf9
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout a97c69ba4f30e46abb9cc7be8b98227cb468fdf9
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
   include/linux/kconfig.h:26:65: note: expanded from macro '____or'
   #define ____or(arg1_or_junk, y)         __take_second_arg(arg1_or_junk 1, y)
                                                                          ^
   drivers/clocksource/sh_cmt.c:997:31: note: Assuming field 'of_node' is null
           if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
                                        ^~~~~~~~~~~~~~~~~
   drivers/clocksource/sh_cmt.c:997:2: note: Taking false branch
           if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
           ^
   drivers/clocksource/sh_cmt.c:1000:13: note: Assuming field 'platform_data' is non-null
           } else if (pdev->dev.platform_data) {
                      ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/clocksource/sh_cmt.c:1000:9: note: Taking true branch
           } else if (pdev->dev.platform_data) {
                  ^
   drivers/clocksource/sh_cmt.c:1013:2: note: Taking false branch
           if (IS_ERR(cmt->clk)) {
           ^
   drivers/clocksource/sh_cmt.c:1019:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   drivers/clocksource/sh_cmt.c:1019:2: note: Taking false branch
           if (ret < 0)
           ^
   drivers/clocksource/sh_cmt.c:1024:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   drivers/clocksource/sh_cmt.c:1024:2: note: Taking false branch
           if (ret < 0)
           ^
   drivers/clocksource/sh_cmt.c:1027:6: note: Assuming field 'width' is not equal to 16
           if (cmt->info->width == 16)
               ^~~~~~~~~~~~~~~~~~~~~~
   drivers/clocksource/sh_cmt.c:1027:2: note: Taking false branch
           if (cmt->info->width == 16)
           ^
   drivers/clocksource/sh_cmt.c:1034:6: note: 'ret' is >= 0
           if (ret < 0)
               ^~~
   drivers/clocksource/sh_cmt.c:1034:2: note: Taking false branch
           if (ret < 0)
           ^
   drivers/clocksource/sh_cmt.c:1038:22: note: '?' condition is false
           cmt->num_channels = hweight8(cmt->hw_channels);
                               ^
   include/asm-generic/bitops/const_hweight.h:26:23: note: expanded from macro 'hweight8'
   #define hweight8(w)  (__builtin_constant_p(w) ? __const_hweight8(w)  : __arch_hweight8(w))
                         ^
   drivers/clocksource/sh_cmt.c:1041:6: note: Assuming field 'channels' is not equal to NULL
           if (cmt->channels == NULL) {
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/clocksource/sh_cmt.c:1041:2: note: Taking false branch
           if (cmt->channels == NULL) {
           ^
   drivers/clocksource/sh_cmt.c:1050:39: note: Assuming 'i' is < field 'num_channels'
           for (i = 0, mask = cmt->hw_channels; i < cmt->num_channels; ++i) {
                                                ^~~~~~~~~~~~~~~~~~~~~
   drivers/clocksource/sh_cmt.c:1050:2: note: Loop condition is true.  Entering loop body
           for (i = 0, mask = cmt->hw_channels; i < cmt->num_channels; ++i) {
           ^
   drivers/clocksource/sh_cmt.c:1052:22: note: 'i' is not equal to 1
                   bool clocksource = i == 1 || cmt->num_channels == 1;
                                      ^
   drivers/clocksource/sh_cmt.c:1052:22: note: Left side of '||' is false
   drivers/clocksource/sh_cmt.c:1052:32: note: Assuming field 'num_channels' is not equal to 1
                   bool clocksource = i == 1 || cmt->num_channels == 1;
                                                ^~~~~~~~~~~~~~~~~~~~~~
   drivers/clocksource/sh_cmt.c:1057:7: note: Assuming 'ret' is >= 0
                   if (ret < 0)
                       ^~~~~~~
   drivers/clocksource/sh_cmt.c:1057:3: note: Taking false branch
                   if (ret < 0)
                   ^
   drivers/clocksource/sh_cmt.c:1050:39: note: Assuming 'i' is < field 'num_channels'
           for (i = 0, mask = cmt->hw_channels; i < cmt->num_channels; ++i) {
                                                ^~~~~~~~~~~~~~~~~~~~~
   drivers/clocksource/sh_cmt.c:1050:2: note: Loop condition is true.  Entering loop body
           for (i = 0, mask = cmt->hw_channels; i < cmt->num_channels; ++i) {
           ^
   drivers/clocksource/sh_cmt.c:1051:3: note: 'hwidx' initialized to 4294967295
                   unsigned int hwidx = ffs(mask) - 1;
                   ^~~~~~~~~~~~~~~~~~
   drivers/clocksource/sh_cmt.c:1052:22: note: 'i' is equal to 1
                   bool clocksource = i == 1 || cmt->num_channels == 1;
                                      ^
   drivers/clocksource/sh_cmt.c:1052:29: note: Left side of '||' is true
                   bool clocksource = i == 1 || cmt->num_channels == 1;
                                             ^
   drivers/clocksource/sh_cmt.c:1057:7: note: Assuming 'ret' is >= 0
                   if (ret < 0)
                       ^~~~~~~
   drivers/clocksource/sh_cmt.c:1057:3: note: Taking false branch
                   if (ret < 0)
                   ^
   drivers/clocksource/sh_cmt.c:1060:15: note: The result of the left shift is undefined due to shifting by '4294967295', which is greater or equal to the width of type 'int'
                   mask &= ~(1 << hwidx);
                               ^  ~~~~~
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
>> drivers/net/ethernet/asix/ax88796c_main.c:548:21: warning: Value stored to 'ndev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct net_device *ndev = ax_local->ndev;
                              ^~~~   ~~~~~~~~~~~~~~
   drivers/net/ethernet/asix/ax88796c_main.c:548:21: note: Value stored to 'ndev' during its initialization is never read
           struct net_device *ndev = ax_local->ndev;
                              ^~~~   ~~~~~~~~~~~~~~
   include/asm-generic/bitops/non-atomic.h:118:16: warning: Array access (from variable 'addr') results in a null pointer dereference [clang-analyzer-core.NullDereference]
           return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
                         ^
   drivers/net/ethernet/asix/ax88796c_main.c:801:6: note: Assuming 'ret' is 0
           if (ret) {
               ^~~
   drivers/net/ethernet/asix/ax88796c_main.c:801:2: note: Taking false branch
           if (ret) {
           ^
   drivers/net/ethernet/asix/ax88796c_main.c:810:6: note: Assuming 'ret' is >= 0
           if (ret < 0) {
               ^~~~~~~
   drivers/net/ethernet/asix/ax88796c_main.c:810:2: note: Taking false branch
           if (ret < 0) {
           ^
   drivers/net/ethernet/asix/ax88796c_main.c:851:6: note: Assuming the condition is false
           if (ax_local->phydev->advertising &&
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/asix/ax88796c_main.c:851:36: note: Left side of '&&' is false
           if (ax_local->phydev->advertising &&
                                             ^
   drivers/net/ethernet/asix/ax88796c_main.c:859:5: note: Passing null pointer value via 2nd parameter 'addr'
                                   ax_local->phydev->advertising) ? AX_FC_RX : 0;
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/asix/ax88796c_main.c:858:8: note: Calling 'linkmode_test_bit'
           fc |= linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/linkmode.h:76:22: note: Passing null pointer value via 2nd parameter 'addr'
           return test_bit(nr, addr);
                               ^~~~
   include/linux/linkmode.h:76:9: note: Calling 'arch_test_bit'
           return test_bit(nr, addr);
                  ^
   include/asm-generic/bitops/non-atomic.h:120:18: note: expanded from macro 'test_bit'
   #define test_bit arch_test_bit
                    ^
   include/asm-generic/bitops/non-atomic.h:118:16: note: Array access (from variable 'addr') results in a null pointer dereference
           return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
                         ^~~~
   Suppressed 5 warnings (4 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (4 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   10 warnings generated.
   drivers/net/ethernet/cadence/macb_main.c:1507:13: warning: Access to field 'addr' results in a dereference of a null pointer (loaded from variable 'desc') [clang-analyzer-core.NullDereference]
           desc->addr |= MACB_BIT(RX_WRAP);
                      ^
   drivers/net/ethernet/cadence/macb_main.c:2438:2: note: Calling 'macb_init_rx_ring'
           macb_init_rx_ring(&bp->queues[0]);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:1497:2: note: 'desc' initialized to a null pointer value
           struct macb_dma_desc *desc = NULL;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:1501:14: note: Assuming 'i' is >= field 'rx_ring_size'
           for (i = 0; i < bp->rx_ring_size; i++) {
                       ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:1501:2: note: Loop condition is false. Execution continues on line 1507
           for (i = 0; i < bp->rx_ring_size; i++) {
           ^
   drivers/net/ethernet/cadence/macb_main.c:1507:13: note: Access to field 'addr' results in a dereference of a null pointer (loaded from variable 'desc')
           desc->addr |= MACB_BIT(RX_WRAP);
           ~~~~       ^
   drivers/net/ethernet/cadence/macb_main.c:2421:14: warning: Access to field 'ctrl' results in a dereference of a null pointer (loaded from variable 'desc') [clang-analyzer-core.NullDereference]
                   desc->ctrl |= MACB_BIT(TX_WRAP);
                   ~~~~       ^
   drivers/net/ethernet/cadence/macb_main.c:2411:2: note: 'desc' initialized to a null pointer value
           struct macb_dma_desc *desc = NULL;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:2415:34: note: Assuming 'q' is < field 'num_queues'
           for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
                                           ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:2415:2: note: Loop condition is true.  Entering loop body
           for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
           ^
   drivers/net/ethernet/cadence/macb_main.c:2416:15: note: Assuming 'i' is >= field 'tx_ring_size'
                   for (i = 0; i < bp->tx_ring_size; i++) {
                               ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:2416:3: note: Loop condition is false. Execution continues on line 2421
                   for (i = 0; i < bp->tx_ring_size; i++) {
                   ^
   drivers/net/ethernet/cadence/macb_main.c:2421:14: note: Access to field 'ctrl' results in a dereference of a null pointer (loaded from variable 'desc')
                   desc->ctrl |= MACB_BIT(TX_WRAP);
                   ~~~~       ^
   drivers/net/ethernet/cadence/macb_main.c:2447:13: warning: Access to field 'ctrl' results in a dereference of a null pointer (loaded from variable 'desc') [clang-analyzer-core.NullDereference]
           desc->ctrl |= MACB_BIT(TX_WRAP);
           ~~~~       ^
   drivers/net/ethernet/cadence/macb_main.c:2436:2: note: 'desc' initialized to a null pointer value
           struct macb_dma_desc *desc = NULL;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:2440:14: note: Assuming 'i' is >= field 'tx_ring_size'
           for (i = 0; i < bp->tx_ring_size; i++) {

vim +/ndev +548 drivers/net/ethernet/asix/ax88796c_main.c

a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  545  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  546  static int ax88796c_process_isr(struct ax88796c_device *ax_local)
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  547  {
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20 @548  	struct net_device *ndev = ax_local->ndev;
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  549  	int todo = 0;
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  550  	u16 isr;
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  551  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  552  	lockdep_assert_held(&ax_local->spi_lock);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  553  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  554  	isr = AX_READ(&ax_local->ax_spi, P0_ISR);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  555  	AX_WRITE(&ax_local->ax_spi, isr, P0_ISR);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  556  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  557  	netif_dbg(ax_local, intr, ndev, "  ISR 0x%04x\n", isr);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  558  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  559  	if (isr & ISR_TXERR) {
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  560  		netif_dbg(ax_local, intr, ndev, "  TXERR interrupt\n");
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  561  		AX_WRITE(&ax_local->ax_spi, TXNR_TXB_REINIT, P0_TSNR);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  562  		ax_local->seq_num = 0x1f;
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  563  	}
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  564  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  565  	if (isr & ISR_TXPAGES) {
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  566  		netif_dbg(ax_local, intr, ndev, "  TXPAGES interrupt\n");
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  567  		set_bit(EVENT_TX, &ax_local->flags);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  568  	}
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  569  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  570  	if (isr & ISR_LINK) {
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  571  		netif_dbg(ax_local, intr, ndev, "  Link change interrupt\n");
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  572  		phy_mac_interrupt(ax_local->ndev->phydev);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  573  	}
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  574  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  575  	if (isr & ISR_RXPKT) {
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  576  		netif_dbg(ax_local, intr, ndev, "  RX interrupt\n");
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  577  		todo = ax88796c_receive(ax_local->ndev);
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  578  	}
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  579  
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  580  	return todo;
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  581  }
a97c69ba4f30e4 Łukasz Stelmach 2021-10-20  582  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* drivers/net/ethernet/asix/ax88796c_main.c:548:21: warning: Value stored to 'ndev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-04-28 18:58 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-04-28 18:58 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 17115 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: "Łukasz Stelmach" <l.stelmach@samsung.com>
CC: Jakub Kicinski <kuba@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8f4dd16603ce834d1c5c4da67803ea82dd282511
commit: a97c69ba4f30e46abb9cc7be8b98227cb468fdf9 net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver
date:   6 months ago
:::::: branch date: 22 hours ago
:::::: commit date: 6 months ago
config: riscv-randconfig-c006-20220427 (https://download.01.org/0day-ci/archive/20220429/202204290236.qMtDvWen-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 1cddcfdc3c683b393df1a5c9063252eb60e52818)
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
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a97c69ba4f30e46abb9cc7be8b98227cb468fdf9
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout a97c69ba4f30e46abb9cc7be8b98227cb468fdf9
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
   drivers/usb/gadget/udc/dummy_hcd.c:2837:8: warning: Access to field 'hs_hcd' results in a dereference of a null pointer [clang-analyzer-core.NullDereference]
                   if (!dum[i]->hs_hcd ||
                        ^~~~~~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2772:2: note: Initializing to a null pointer value
           struct  dummy *dum[MAX_NUM_UDC] = {};
           ^~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2774:6: note: Assuming the condition is false
           if (usb_disabled())
               ^~~~~~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2774:2: note: Taking false branch
           if (usb_disabled())
           ^
   drivers/usb/gadget/udc/dummy_hcd.c:2777:6: note: Assuming field 'is_high_speed' is true
           if (!mod_data.is_high_speed && mod_data.is_super_speed)
               ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2777:30: note: Left side of '&&' is false
           if (!mod_data.is_high_speed && mod_data.is_super_speed)
                                       ^
   drivers/usb/gadget/udc/dummy_hcd.c:2780:6: note: Assuming field 'num' is >= 1
           if (mod_data.num < 1 || mod_data.num > MAX_NUM_UDC) {
               ^~~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2780:6: note: Left side of '||' is false
   drivers/usb/gadget/udc/dummy_hcd.c:2780:26: note: Assuming field 'num' is <= MAX_NUM_UDC
           if (mod_data.num < 1 || mod_data.num > MAX_NUM_UDC) {
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2780:2: note: Taking false branch
           if (mod_data.num < 1 || mod_data.num > MAX_NUM_UDC) {
           ^
   drivers/usb/gadget/udc/dummy_hcd.c:2786:14: note: 'i' is < field 'num'
           for (i = 0; i < mod_data.num; i++) {
                       ^
   drivers/usb/gadget/udc/dummy_hcd.c:2786:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < mod_data.num; i++) {
           ^
   drivers/usb/gadget/udc/dummy_hcd.c:2788:7: note: Assuming the condition is false
                   if (!the_hcd_pdev[i]) {
                       ^~~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2788:3: note: Taking false branch
                   if (!the_hcd_pdev[i]) {
                   ^
   drivers/usb/gadget/udc/dummy_hcd.c:2786:14: note: Assuming 'i' is >= field 'num'
           for (i = 0; i < mod_data.num; i++) {
                       ^~~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2786:2: note: Loop condition is false. Execution continues on line 2795
           for (i = 0; i < mod_data.num; i++) {
           ^
   drivers/usb/gadget/udc/dummy_hcd.c:2795:14: note: Assuming 'i' is >= field 'num'
           for (i = 0; i < mod_data.num; i++) {
                       ^~~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2795:2: note: Loop condition is false. Execution continues on line 2804
           for (i = 0; i < mod_data.num; i++) {
           ^
   drivers/usb/gadget/udc/dummy_hcd.c:2804:2: note: Loop condition is false. Execution continues on line 2820
           for (i = 0; i < mod_data.num; i++) {
           ^
   drivers/usb/gadget/udc/dummy_hcd.c:2821:6: note: Assuming 'retval' is >= 0
           if (retval < 0)
               ^~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2821:2: note: Taking false branch
           if (retval < 0)
           ^
   drivers/usb/gadget/udc/dummy_hcd.c:2824:6: note: Assuming 'retval' is >= 0
           if (retval < 0)
               ^~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2824:2: note: Taking false branch
           if (retval < 0)
           ^
   drivers/usb/gadget/udc/dummy_hcd.c:2827:14: note: Assuming 'i' is < field 'num'
           for (i = 0; i < mod_data.num; i++) {
                       ^~~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2827:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < mod_data.num; i++) {
           ^
   drivers/usb/gadget/udc/dummy_hcd.c:2829:7: note: Assuming 'retval' is >= 0
                   if (retval < 0) {
                       ^~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2829:3: note: Taking false branch
                   if (retval < 0) {
                   ^
   drivers/usb/gadget/udc/dummy_hcd.c:2827:14: note: Assuming 'i' is >= field 'num'
           for (i = 0; i < mod_data.num; i++) {
                       ^~~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2827:2: note: Loop condition is false. Execution continues on line 2836
           for (i = 0; i < mod_data.num; i++) {
           ^
   drivers/usb/gadget/udc/dummy_hcd.c:2836:7: note: The value 0 is assigned to 'i'
           for (i = 0; i < mod_data.num; i++) {
                ^~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2836:14: note: Assuming 'i' is < field 'num'
           for (i = 0; i < mod_data.num; i++) {
                       ^~~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/dummy_hcd.c:2836:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < mod_data.num; i++) {
           ^
   drivers/usb/gadget/udc/dummy_hcd.c:2837:8: note: Access to field 'hs_hcd' results in a dereference of a null pointer
                   if (!dum[i]->hs_hcd ||
                        ^~~~~~~~~~~~~~
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
>> drivers/net/ethernet/asix/ax88796c_main.c:548:21: warning: Value stored to 'ndev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct net_device *ndev = ax_local->ndev;
                              ^~~~   ~~~~~~~~~~~~~~
   drivers/net/ethernet/asix/ax88796c_main.c:548:21: note: Value stored to 'ndev' during its initialization is never read
           struct net_device *ndev = ax_local->ndev;
                              ^~~~   ~~~~~~~~~~~~~~
   include/asm-generic/bitops/non-atomic.h:118:16: warning: Array access (from variable 'addr') results in a null pointer dereference [clang-analyzer-core.NullDereference]
           return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
                         ^
   drivers/net/ethernet/asix/ax88796c_main.c:801:6: note: Assuming 'ret' is 0
           if (ret) {
               ^~~
   drivers/net/ethernet/asix/ax88796c_main.c:801:2: note: Taking false branch
           if (ret) {
           ^
   drivers/net/ethernet/asix/ax88796c_main.c:810:6: note: Assuming 'ret' is >= 0
           if (ret < 0) {
               ^~~~~~~
   drivers/net/ethernet/asix/ax88796c_main.c:810:2: note: Taking false branch
           if (ret < 0) {
           ^
   drivers/net/ethernet/asix/ax88796c_main.c:851:6: note: Assuming the condition is false
           if (ax_local->phydev->advertising &&
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/asix/ax88796c_main.c:851:36: note: Left side of '&&' is false
           if (ax_local->phydev->advertising &&
                                             ^
   drivers/net/ethernet/asix/ax88796c_main.c:859:5: note: Passing null pointer value via 2nd parameter 'addr'
                                   ax_local->phydev->advertising) ? AX_FC_RX : 0;
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/asix/ax88796c_main.c:858:8: note: Calling 'linkmode_test_bit'
           fc |= linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/linkmode.h:76:22: note: Passing null pointer value via 2nd parameter 'addr'
           return test_bit(nr, addr);
                               ^~~~
   include/linux/linkmode.h:76:9: note: Calling 'arch_test_bit'
           return test_bit(nr, addr);
                  ^
   include/asm-generic/bitops/non-atomic.h:120:18: note: expanded from macro 'test_bit'
   #define test_bit arch_test_bit
                    ^
   include/asm-generic/bitops/non-atomic.h:118:16: note: Array access (from variable 'addr') results in a null pointer dereference
           return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
                         ^~~~
   Suppressed 5 warnings (4 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (4 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   10 warnings generated.
   drivers/net/ethernet/cadence/macb_main.c:1507:13: warning: Access to field 'addr' results in a dereference of a null pointer (loaded from variable 'desc') [clang-analyzer-core.NullDereference]
           desc->addr |= MACB_BIT(RX_WRAP);
                      ^
   drivers/net/ethernet/cadence/macb_main.c:2438:2: note: Calling 'macb_init_rx_ring'
           macb_init_rx_ring(&bp->queues[0]);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:1497:2: note: 'desc' initialized to a null pointer value
           struct macb_dma_desc *desc = NULL;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:1501:14: note: Assuming 'i' is >= field 'rx_ring_size'
           for (i = 0; i < bp->rx_ring_size; i++) {
                       ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:1501:2: note: Loop condition is false. Execution continues on line 1507
           for (i = 0; i < bp->rx_ring_size; i++) {
           ^
   drivers/net/ethernet/cadence/macb_main.c:1507:13: note: Access to field 'addr' results in a dereference of a null pointer (loaded from variable 'desc')
           desc->addr |= MACB_BIT(RX_WRAP);
           ~~~~       ^
   drivers/net/ethernet/cadence/macb_main.c:2421:14: warning: Access to field 'ctrl' results in a dereference of a null pointer (loaded from variable 'desc') [clang-analyzer-core.NullDereference]
                   desc->ctrl |= MACB_BIT(TX_WRAP);
                   ~~~~       ^
   drivers/net/ethernet/cadence/macb_main.c:2411:2: note: 'desc' initialized to a null pointer value
           struct macb_dma_desc *desc = NULL;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:2415:34: note: Assuming 'q' is < field 'num_queues'
           for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
                                           ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:2415:2: note: Loop condition is true.  Entering loop body
           for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
           ^
   drivers/net/ethernet/cadence/macb_main.c:2416:15: note: Assuming 'i' is >= field 'tx_ring_size'
                   for (i = 0; i < bp->tx_ring_size; i++) {
                               ^~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:2416:3: note: Loop condition is false. Execution continues on line 2421
                   for (i = 0; i < bp->tx_ring_size; i++) {
                   ^
   drivers/net/ethernet/cadence/macb_main.c:2421:14: note: Access to field 'ctrl' results in a dereference of a null pointer (loaded from variable 'desc')
                   desc->ctrl |= MACB_BIT(TX_WRAP);
                   ~~~~       ^
   drivers/net/ethernet/cadence/macb_main.c:2447:13: warning: Access to field 'ctrl' results in a dereference of a null pointer (loaded from variable 'desc') [clang-analyzer-core.NullDereference]
           desc->ctrl |= MACB_BIT(TX_WRAP);
           ~~~~       ^
   drivers/net/ethernet/cadence/macb_main.c:2436:2: note: 'desc' initialized to a null pointer value
           struct macb_dma_desc *desc = NULL;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/cadence/macb_main.c:2440:14: note: Assuming 'i' is >= field 'tx_ring_size'
           for (i = 0; i < bp->tx_ring_size; i++) {

vim +/ndev +548 drivers/net/ethernet/asix/ax88796c_main.c

a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  545  
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  546  static int ax88796c_process_isr(struct ax88796c_device *ax_local)
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  547  {
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20 @548  	struct net_device *ndev = ax_local->ndev;
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  549  	int todo = 0;
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  550  	u16 isr;
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  551  
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  552  	lockdep_assert_held(&ax_local->spi_lock);
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  553  
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  554  	isr = AX_READ(&ax_local->ax_spi, P0_ISR);
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  555  	AX_WRITE(&ax_local->ax_spi, isr, P0_ISR);
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  556  
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  557  	netif_dbg(ax_local, intr, ndev, "  ISR 0x%04x\n", isr);
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  558  
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  559  	if (isr & ISR_TXERR) {
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  560  		netif_dbg(ax_local, intr, ndev, "  TXERR interrupt\n");
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  561  		AX_WRITE(&ax_local->ax_spi, TXNR_TXB_REINIT, P0_TSNR);
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  562  		ax_local->seq_num = 0x1f;
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  563  	}
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  564  
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  565  	if (isr & ISR_TXPAGES) {
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  566  		netif_dbg(ax_local, intr, ndev, "  TXPAGES interrupt\n");
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  567  		set_bit(EVENT_TX, &ax_local->flags);
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  568  	}
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  569  
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  570  	if (isr & ISR_LINK) {
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  571  		netif_dbg(ax_local, intr, ndev, "  Link change interrupt\n");
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  572  		phy_mac_interrupt(ax_local->ndev->phydev);
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  573  	}
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  574  
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  575  	if (isr & ISR_RXPKT) {
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  576  		netif_dbg(ax_local, intr, ndev, "  RX interrupt\n");
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  577  		todo = ax88796c_receive(ax_local->ndev);
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  578  	}
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  579  
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  580  	return todo;
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  581  }
a97c69ba4f30e46 Łukasz Stelmach 2021-10-20  582  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

end of thread, other threads:[~2022-05-06  5:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06  5:03 drivers/net/ethernet/asix/ax88796c_main.c:548:21: warning: Value stored to 'ndev' during its initialization is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-04-30  3:29 kernel test robot
2022-04-28 18:58 kernel test robot

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.