public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Bo Jiao <Bo.Jiao@mediatek.com>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org, Felix Fietkau <nbd@nbd.name>,
	Sujuan Chen <sujuan.chen@mediatek.com>,
	Ryder Lee <ryder.lee@mediatek.com>
Subject: [nbd168-wireless:mt76 5/28] drivers/net/wireless/mediatek/mt76/mt7915/dma.c:97:6: warning: variable 'base' is used uninitialized whenever 'if' condition is false
Date: Thu, 23 Dec 2021 07:25:34 +0800	[thread overview]
Message-ID: <202112230704.dKCp3lmX-lkp@intel.com> (raw)

tree:   https://github.com/nbd168/wireless mt76
head:   05f0500c7b0147353e97de7369d504c5fbd3951e
commit: 22c2fb9495d35e0c442c23bcd3b8a4a18a28c62d [5/28] mt76: mt7915: rework dma.c to adapt mt7916 changes
config: mips-randconfig-r033-20211222 (https://download.01.org/0day-ci/archive/20211223/202112230704.dKCp3lmX-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project de4e0195ae1c39f1c3b07834b8e32c113f4f20eb)
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 mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://github.com/nbd168/wireless/commit/22c2fb9495d35e0c442c23bcd3b8a4a18a28c62d
        git remote add nbd168-wireless https://github.com/nbd168/wireless
        git fetch --no-tags nbd168-wireless mt76
        git checkout 22c2fb9495d35e0c442c23bcd3b8a4a18a28c62d
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/net/wireless/mediatek/mt76/mt7915/

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

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/mediatek/mt76/mt7915/dma.c:97:6: warning: variable 'base' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (!is_mt7915(&dev->mt76)) {
               ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/mediatek/mt76/mt7915/dma.c:101:70: note: uninitialized use occurs here
           mt76_wr(dev, MT_RXQ_EXT_CTRL(MT_RXQ_EXT_WA) + ofs, PREFETCH(0x1c0 + base, 0x4));
                                                                               ^~~~
   drivers/net/wireless/mediatek/mt76/mt7915/dma.c:85:35: note: expanded from macro 'PREFETCH'
   #define PREFETCH(_base, _depth) ((_base) << 16 | (_depth))
                                     ^~~~~
   drivers/net/wireless/mediatek/mt76/mt7915/../mt76.h:829:63: note: expanded from macro 'mt76_wr'
   #define mt76_wr(dev, ...)       (dev)->mt76.bus->wr(&((dev)->mt76), __VA_ARGS__)
                                                                       ^~~~~~~~~~~
   drivers/net/wireless/mediatek/mt76/mt7915/dma.c:97:2: note: remove the 'if' if its condition is always true
           if (!is_mt7915(&dev->mt76)) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/mediatek/mt76/mt7915/dma.c:86:10: note: initialize the variable 'base' to silence this warning
           u32 base;
                   ^
                    = 0
   1 warning generated.


vim +97 drivers/net/wireless/mediatek/mt76/mt7915/dma.c

    82	
    83	static void __mt7915_dma_prefetch(struct mt7915_dev *dev, u32 ofs)
    84	{
    85	#define PREFETCH(_base, _depth)	((_base) << 16 | (_depth))
    86		u32 base;
    87	
    88		/* prefetch SRAM wrapping boundary for tx/rx ring. */
    89		mt76_wr(dev, MT_MCUQ_EXT_CTRL(MT_MCUQ_FWDL) + ofs, PREFETCH(0x0, 0x4));
    90		mt76_wr(dev, MT_MCUQ_EXT_CTRL(MT_MCUQ_WM) + ofs, PREFETCH(0x40, 0x4));
    91		mt76_wr(dev, MT_TXQ_EXT_CTRL(0) + ofs, PREFETCH(0x80, 0x4));
    92		mt76_wr(dev, MT_TXQ_EXT_CTRL(1) + ofs, PREFETCH(0xc0, 0x4));
    93		mt76_wr(dev, MT_MCUQ_EXT_CTRL(MT_MCUQ_WA) + ofs, PREFETCH(0x100, 0x4));
    94	
    95		mt76_wr(dev, MT_RXQ_EXT_CTRL(MT_RXQ_MCU) + ofs, PREFETCH(0x140, 0x4));
    96		mt76_wr(dev, MT_RXQ_EXT_CTRL(MT_RXQ_MCU_WA) + ofs, PREFETCH(0x180, 0x4));
  > 97		if (!is_mt7915(&dev->mt76)) {
    98			mt76_wr(dev, MT_RXQ_EXT_CTRL(MT_RXQ_MAIN_WA) + ofs, PREFETCH(0x1c0, 0x4));
    99			base = 0x40;
   100		}
   101		mt76_wr(dev, MT_RXQ_EXT_CTRL(MT_RXQ_EXT_WA) + ofs, PREFETCH(0x1c0 + base, 0x4));
   102		mt76_wr(dev, MT_RXQ_EXT_CTRL(MT_RXQ_MAIN) + ofs, PREFETCH(0x200 + base, 0x4));
   103		mt76_wr(dev, MT_RXQ_EXT_CTRL(MT_RXQ_EXT) + ofs, PREFETCH(0x240 + base, 0x4));
   104	
   105		/* for mt7915, the ring which is next the last
   106		 * used ring must be initialized.
   107		 */
   108		if (is_mt7915(&dev->mt76)) {
   109			ofs += 0x4;
   110			mt76_wr(dev, MT_MCUQ_EXT_CTRL(MT_MCUQ_WA) + ofs, PREFETCH(0x140, 0x0));
   111			mt76_wr(dev, MT_RXQ_EXT_CTRL(MT_RXQ_EXT_WA) + ofs, PREFETCH(0x200 + base, 0x0));
   112			mt76_wr(dev, MT_RXQ_EXT_CTRL(MT_RXQ_EXT) + ofs, PREFETCH(0x280 + base, 0x0));
   113		}
   114	}
   115	

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

                 reply	other threads:[~2021-12-22 23:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202112230704.dKCp3lmX-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Bo.Jiao@mediatek.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sujuan.chen@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox