drivers/net/ethernet/smsc/smc91x.c:634:23: warning: variable 'flags' set but not used
From: kernel test robot
Date: Mon Sep 27 2021 - 09:33:07 EST
Hi Andrew,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 92477dd1faa650e50bd3bb35a6c0b8d09198cc35
commit: 7958ba7e6273a02f49432a2506958d0f59b5b8da drivers: net: smsc: Add COMPILE_TEST support
date: 11 months ago
config: microblaze-randconfig-r012-20210927 (attached as .config)
compiler: microblaze-linux-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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7958ba7e6273a02f49432a2506958d0f59b5b8da
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 7958ba7e6273a02f49432a2506958d0f59b5b8da
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=microblaze
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
drivers/net/ethernet/smsc/smc91x.c: In function 'smc_hard_start_xmit':
>> drivers/net/ethernet/smsc/smc91x.c:634:23: warning: variable 'flags' set but not used [-Wunused-but-set-variable]
634 | unsigned long flags;
| ^~~~~
vim +/flags +634 drivers/net/ethernet/smsc/smc91x.c
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 621
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 622 /*
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 623 * Since I am not sure if I will have enough room in the chip's ram
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 624 * to store the packet, I call this routine which either sends it
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 625 * now, or set the card to generates an interrupt when ready
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 626 * for the packet.
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 627 */
6323d57f335ce1 drivers/net/ethernet/smsc/smc91x.c YueHaibing 2018-09-26 628 static netdev_tx_t
6323d57f335ce1 drivers/net/ethernet/smsc/smc91x.c YueHaibing 2018-09-26 629 smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 630 {
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 631 struct smc_local *lp = netdev_priv(dev);
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 632 void __iomem *ioaddr = lp->base;
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 633 unsigned int numPages, poll_count, status;
8ff499e43c5376 drivers/net/smc91x.c Dongdong Deng 2009-08-23 @634 unsigned long flags;
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 635
6389aa458ed995 drivers/net/ethernet/smsc/smc91x.c Ben Boeckel 2013-11-01 636 DBG(3, dev, "%s\n", __func__);
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 637
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 638 BUG_ON(lp->pending_tx_skb != NULL);
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 639
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 640 /*
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 641 * The MMU wants the number of pages to be the number of 256 bytes
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 642 * 'pages', minus 1 (since a packet can't ever have 0 pages :))
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 643 *
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 644 * The 91C111 ignores the size bits, but earlier models don't.
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 645 *
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 646 * Pkt size for allocating is data length +6 (for additional status
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 647 * words, length and ctl)
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 648 *
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 649 * If odd size then last byte is included in ctl word.
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 650 */
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 651 numPages = ((skb->len & ~1) + (6 - 1)) >> 8;
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 652 if (unlikely(numPages > 7)) {
6389aa458ed995 drivers/net/ethernet/smsc/smc91x.c Ben Boeckel 2013-11-01 653 netdev_warn(dev, "Far too big packet error.\n");
09f75cd7bf1372 drivers/net/smc91x.c Jeff Garzik 2007-10-03 654 dev->stats.tx_errors++;
09f75cd7bf1372 drivers/net/smc91x.c Jeff Garzik 2007-10-03 655 dev->stats.tx_dropped++;
4b61fe2621e40f drivers/net/ethernet/smsc/smc91x.c Eric W. Biederman 2014-03-15 656 dev_kfree_skb_any(skb);
6ed106549d1747 drivers/net/smc91x.c Patrick McHardy 2009-06-23 657 return NETDEV_TX_OK;
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 658 }
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 659
8ff499e43c5376 drivers/net/smc91x.c Dongdong Deng 2009-08-23 660 smc_special_lock(&lp->lock, flags);
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 661
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 662 /* now, try to allocate the memory */
cfdfa86536d2fb drivers/net/smc91x.c Magnus Damm 2008-02-22 663 SMC_SET_MMU_CMD(lp, MC_ALLOC | numPages);
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 664
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 665 /*
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 666 * Poll the chip for a short amount of time in case the
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 667 * allocation succeeds quickly.
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 668 */
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 669 poll_count = MEMORY_WAIT_TIME;
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 670 do {
cfdfa86536d2fb drivers/net/smc91x.c Magnus Damm 2008-02-22 671 status = SMC_GET_INT(lp);
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 672 if (status & IM_ALLOC_INT) {
cfdfa86536d2fb drivers/net/smc91x.c Magnus Damm 2008-02-22 673 SMC_ACK_INT(lp, IM_ALLOC_INT);
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 674 break;
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 675 }
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 676 } while (--poll_count);
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 677
8ff499e43c5376 drivers/net/smc91x.c Dongdong Deng 2009-08-23 678 smc_special_unlock(&lp->lock, flags);
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 679
be83668a253149 drivers/net/smc91x.c Nicolas Pitre 2005-06-19 680 lp->pending_tx_skb = skb;
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 681 if (!poll_count) {
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 682 /* oh well, wait until the chip finds memory later */
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 683 netif_stop_queue(dev);
6389aa458ed995 drivers/net/ethernet/smsc/smc91x.c Ben Boeckel 2013-11-01 684 DBG(2, dev, "TX memory allocation deferred.\n");
cfdfa86536d2fb drivers/net/smc91x.c Magnus Damm 2008-02-22 685 SMC_ENABLE_INT(lp, IM_ALLOC_INT);
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 686 } else {
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 687 /*
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 688 * Allocation succeeded: push packet to the chip's own memory
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 689 * immediately.
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 690 */
7961fb1089f826 drivers/net/ethernet/smsc/smc91x.c Allen Pais 2020-09-14 691 smc_hardware_send_pkt(&lp->tx_task);
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 692 }
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 693
6ed106549d1747 drivers/net/smc91x.c Patrick McHardy 2009-06-23 694 return NETDEV_TX_OK;
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 695 }
^1da177e4c3f41 drivers/net/smc91x.c Linus Torvalds 2005-04-16 696
:::::: The code at line 634 was first introduced by commit
:::::: 8ff499e43c537648399fca8ba39d24c0768b3fab smc91x: let smc91x work well under netpoll
:::::: TO: Dongdong Deng <dongdong.deng@xxxxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip