[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdaBE-wyhiekdW9WtO=zdpDqjZuT7DqqsT2kWzeDGepivQ@mail.gmail.com>
Date: Thu, 16 Dec 2021 04:12:00 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Nathan Chancellor <nathan@...nel.org>
Cc: kernel test robot <lkp@...el.com>,
Jason Wang <wangborong@...rlc.com>, llvm@...ts.linux.dev,
kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: Re: drivers/pinctrl/bcm/pinctrl-bcm2835.c:412:14: warning: variable
'group' is used uninitialized whenever 'for' loop exits because its condition
is false
On Tue, Dec 14, 2021 at 7:41 PM Nathan Chancellor <nathan@...nel.org> wrote:
> On Tue, Dec 14, 2021 at 10:44:28PM +0800, kernel test robot wrote:
> > Hi Jason,
> >
> > FYI, the error/warning still remains.
> >
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: 5472f14a37421d1bca3dddf33cabd3bd6dbefbbc
> > commit: 29d45a642d4ea8de7e89b57f856046df7c3b219f pinctrl: bcm2835: Replace BUG with BUG_ON
> > date: 5 months ago
> > config: mips-randconfig-c004-20211214 (https://download.01.org/0day-ci/archive/20211214/202112142208.QW0tVv0m-lkp@intel.com/config)
> > compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a2ddb6c8ac29412b1361810972e15221fa021c)
> > 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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=29d45a642d4ea8de7e89b57f856046df7c3b219f
> > git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > git fetch --no-tags linus master
> > git checkout 29d45a642d4ea8de7e89b57f856046df7c3b219f
> > # 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/pinctrl/bcm/
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@...el.com>
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> drivers/pinctrl/bcm/pinctrl-bcm2835.c:412:14: warning: variable 'group' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
> > for (i = 0; i < BCM2835_NUM_IRQS; i++) {
> > ^~~~~~~~~~~~~~~~~~~~
> > drivers/pinctrl/bcm/pinctrl-bcm2835.c:423:10: note: uninitialized use occurs here
> > switch (group) {
> > ^~~~~
> > drivers/pinctrl/bcm/pinctrl-bcm2835.c:412:14: note: remove the condition if it is always true
> > for (i = 0; i < BCM2835_NUM_IRQS; i++) {
> > ^~~~~~~~~~~~~~~~~~~~
> > drivers/pinctrl/bcm/pinctrl-bcm2835.c:409:11: note: initialize the variable 'group' to silence this warning
> > int group;
> > ^
> > = 0
> > 1 warning generated.
>
> It seems like MIP's __BUG_ON() makes it harder for clang to figure out
> that 'i == BCM2835_NUM_IRQS' will make the kernel panic, which is the
> only way that the loop exits because the condition is false.
>
> I am not really sure of a way to fix this other than just reverting that
> change or changing the BUG_ON() to WARN_ON().
We can also just ignore the test robot like any invalid
review comment.
The maintainer of this driver can decide, if it's up to me I'd
just ignore it.
Yours,
Linus Walleij
Powered by blists - more mailing lists