drivers/net/ethernet/broadcom/bcm4908_enet.c:637:15: warning: variable 'bytes' set but not used

From: kernel test robot
Date: Wed Jun 02 2021 - 17:39:58 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 324c92e5e0ee0e993bdb106fac407846ed677f6b
commit: 12bb508bfe5a564c36864b12253db23cac83bfa1 net: broadcom: bcm4908_enet: support TX interrupt
date: 3 months ago
config: powerpc64-randconfig-r026-20210602 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d41cb6bb2607fa5c7a9df2b3dab361353657d225)
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 powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=12bb508bfe5a564c36864b12253db23cac83bfa1
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 12bb508bfe5a564c36864b12253db23cac83bfa1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64

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

All warnings (new ones prefixed by >>):

In file included from drivers/net/ethernet/broadcom/bcm4908_enet.c:6:
In file included from include/linux/delay.h:22:
In file included from include/linux/kernel.h:11:
In file included from include/linux/bitops.h:32:
In file included from arch/powerpc/include/asm/bitops.h:62:
arch/powerpc/include/asm/barrier.h:49:9: warning: '__lwsync' macro redefined [-Wmacro-redefined]
#define __lwsync() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")
^
<built-in>:310:9: note: previous definition is here
#define __lwsync __builtin_ppc_lwsync
^
>> drivers/net/ethernet/broadcom/bcm4908_enet.c:637:15: warning: variable 'bytes' set but not used [-Wunused-but-set-variable]
unsigned int bytes = 0;
^
2 warnings generated.


vim +/bytes +637 drivers/net/ethernet/broadcom/bcm4908_enet.c

629
630 static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
631 {
632 struct bcm4908_enet_dma_ring *tx_ring = container_of(napi, struct bcm4908_enet_dma_ring, napi);
633 struct bcm4908_enet *enet = container_of(tx_ring, struct bcm4908_enet, tx_ring);
634 struct bcm4908_enet_dma_ring_bd *buf_desc;
635 struct bcm4908_enet_dma_ring_slot *slot;
636 struct device *dev = enet->dev;
> 637 unsigned int bytes = 0;
638 int handled = 0;
639
640 while (handled < weight && tx_ring->read_idx != tx_ring->write_idx) {
641 buf_desc = &tx_ring->buf_desc[tx_ring->read_idx];
642 if (le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)
643 break;
644 slot = &tx_ring->slots[tx_ring->read_idx];
645
646 dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE);
647 dev_kfree_skb(slot->skb);
648 bytes += slot->len;
649 if (++tx_ring->read_idx == tx_ring->length)
650 tx_ring->read_idx = 0;
651
652 handled++;
653 }
654
655 if (handled < weight) {
656 napi_complete_done(napi, handled);
657 bcm4908_enet_dma_ring_intrs_on(enet, tx_ring);
658 }
659
660 if (netif_queue_stopped(enet->netdev))
661 netif_wake_queue(enet->netdev);
662
663 return handled;
664 }
665

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip