All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match'
@ 2021-01-06 20:04 ` kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-01-06 20:04 UTC (permalink / raw)
  To: Pawel Czarnecki
  Cc: kbuild-all, clang-built-linux, linux-kernel, Stafford Horne,
	Mateusz Holenko

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

Hi Pawel,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
commit: 22447a99c97e353bde8f90c2353873f27681d57c drivers/soc/litex: add LiteX SoC Controller driver
date:   8 weeks ago
config: x86_64-randconfig-a001-20210107 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5c951623bc8965fa1e89660f2f5f4a2944e4981a)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=22447a99c97e353bde8f90c2353873f27681d57c
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 22447a99c97e353bde8f90c2353873f27681d57c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match' [-Wunused-const-variable]
   static const struct of_device_id litex_soc_ctrl_of_match[] = {
                                    ^
   1 warning generated.


vim +/litex_soc_ctrl_of_match +143 drivers/soc/litex/litex_soc_ctrl.c

   142	
 > 143	static const struct of_device_id litex_soc_ctrl_of_match[] = {
   144		{.compatible = "litex,soc-controller"},
   145		{},
   146	};
   147	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35339 bytes --]

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

* drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match'
@ 2021-01-06 20:04 ` kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-01-06 20:04 UTC (permalink / raw)
  To: kbuild-all

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

Hi Pawel,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
commit: 22447a99c97e353bde8f90c2353873f27681d57c drivers/soc/litex: add LiteX SoC Controller driver
date:   8 weeks ago
config: x86_64-randconfig-a001-20210107 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5c951623bc8965fa1e89660f2f5f4a2944e4981a)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=22447a99c97e353bde8f90c2353873f27681d57c
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 22447a99c97e353bde8f90c2353873f27681d57c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match' [-Wunused-const-variable]
   static const struct of_device_id litex_soc_ctrl_of_match[] = {
                                    ^
   1 warning generated.


vim +/litex_soc_ctrl_of_match +143 drivers/soc/litex/litex_soc_ctrl.c

   142	
 > 143	static const struct of_device_id litex_soc_ctrl_of_match[] = {
   144		{.compatible = "litex,soc-controller"},
   145		{},
   146	};
   147	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35339 bytes --]

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

* Re: drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match'
  2021-01-06 20:04 ` kernel test robot
@ 2021-01-11 12:30   ` Stafford Horne
  -1 siblings, 0 replies; 9+ messages in thread
From: Stafford Horne @ 2021-01-11 12:30 UTC (permalink / raw)
  To: kernel test robot
  Cc: Pawel Czarnecki, kbuild-all, clang-built-linux, linux-kernel,
	Mateusz Holenko

On Thu, Jan 07, 2021 at 04:04:47AM +0800, kernel test robot wrote:
> Hi Pawel,
> 
> FYI, the error/warning still remains.
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
> commit: 22447a99c97e353bde8f90c2353873f27681d57c drivers/soc/litex: add LiteX SoC Controller driver
> date:   8 weeks ago
> config: x86_64-randconfig-a001-20210107 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5c951623bc8965fa1e89660f2f5f4a2944e4981a)
> 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 x86_64 cross compiling tool for clang build
>         # apt-get install binutils-x86-64-linux-gnu
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=22447a99c97e353bde8f90c2353873f27681d57c
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout 22447a99c97e353bde8f90c2353873f27681d57c
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
> 
> 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/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match' [-Wunused-const-variable]
>    static const struct of_device_id litex_soc_ctrl_of_match[] = {
>                                     ^
>    1 warning generated.
> 
> 
> vim +/litex_soc_ctrl_of_match +143 drivers/soc/litex/litex_soc_ctrl.c
> 
>    142	
>  > 143	static const struct of_device_id litex_soc_ctrl_of_match[] = {
>    144		{.compatible = "litex,soc-controller"},
>    145		{},
>    146	};
>    147	
> 

I don't use clang but GCC, and I cannot reproduce this warning.

$ make drivers/soc/litex/litex_soc_ctrl.o 
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
  CC      drivers/soc/litex/litex_soc_ctrl.o

Also, I can see litex_soc_ctrl_of_match is used.  I am not sure what is going on
here.

-Stafford

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

* Re: drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match'
@ 2021-01-11 12:30   ` Stafford Horne
  0 siblings, 0 replies; 9+ messages in thread
From: Stafford Horne @ 2021-01-11 12:30 UTC (permalink / raw)
  To: kbuild-all

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

On Thu, Jan 07, 2021 at 04:04:47AM +0800, kernel test robot wrote:
> Hi Pawel,
> 
> FYI, the error/warning still remains.
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
> commit: 22447a99c97e353bde8f90c2353873f27681d57c drivers/soc/litex: add LiteX SoC Controller driver
> date:   8 weeks ago
> config: x86_64-randconfig-a001-20210107 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5c951623bc8965fa1e89660f2f5f4a2944e4981a)
> 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 x86_64 cross compiling tool for clang build
>         # apt-get install binutils-x86-64-linux-gnu
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=22447a99c97e353bde8f90c2353873f27681d57c
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout 22447a99c97e353bde8f90c2353873f27681d57c
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
> 
> 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/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match' [-Wunused-const-variable]
>    static const struct of_device_id litex_soc_ctrl_of_match[] = {
>                                     ^
>    1 warning generated.
> 
> 
> vim +/litex_soc_ctrl_of_match +143 drivers/soc/litex/litex_soc_ctrl.c
> 
>    142	
>  > 143	static const struct of_device_id litex_soc_ctrl_of_match[] = {
>    144		{.compatible = "litex,soc-controller"},
>    145		{},
>    146	};
>    147	
> 

I don't use clang but GCC, and I cannot reproduce this warning.

$ make drivers/soc/litex/litex_soc_ctrl.o 
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
  CC      drivers/soc/litex/litex_soc_ctrl.o

Also, I can see litex_soc_ctrl_of_match is used.  I am not sure what is going on
here.

-Stafford

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

* Re: drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match'
  2021-01-11 12:30   ` Stafford Horne
  (?)
@ 2021-01-11 16:43   ` Nathan Chancellor
  2021-01-11 21:14       ` Stafford Horne
  -1 siblings, 1 reply; 9+ messages in thread
From: Nathan Chancellor @ 2021-01-11 16:43 UTC (permalink / raw)
  To: Stafford Horne
  Cc: kernel test robot, Pawel Czarnecki, kbuild-all,
	clang-built-linux, linux-kernel, Mateusz Holenko

On Mon, Jan 11, 2021 at 09:30:55PM +0900, Stafford Horne wrote:
> On Thu, Jan 07, 2021 at 04:04:47AM +0800, kernel test robot wrote:
> > Hi Pawel,
> > 
> > FYI, the error/warning still remains.
> > 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
> > commit: 22447a99c97e353bde8f90c2353873f27681d57c drivers/soc/litex: add LiteX SoC Controller driver
> > date:   8 weeks ago
> > config: x86_64-randconfig-a001-20210107 (attached as .config)
> > compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5c951623bc8965fa1e89660f2f5f4a2944e4981a)
> > 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 x86_64 cross compiling tool for clang build
> >         # apt-get install binutils-x86-64-linux-gnu
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=22447a99c97e353bde8f90c2353873f27681d57c
> >         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> >         git fetch --no-tags linus master
> >         git checkout 22447a99c97e353bde8f90c2353873f27681d57c
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
> > 
> > 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/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match' [-Wunused-const-variable]
> >    static const struct of_device_id litex_soc_ctrl_of_match[] = {
> >                                     ^
> >    1 warning generated.
> > 
> > 
> > vim +/litex_soc_ctrl_of_match +143 drivers/soc/litex/litex_soc_ctrl.c
> > 
> >    142	
> >  > 143	static const struct of_device_id litex_soc_ctrl_of_match[] = {
> >    144		{.compatible = "litex,soc-controller"},
> >    145		{},
> >    146	};
> >    147	
> > 
> 
> I don't use clang but GCC, and I cannot reproduce this warning.
> 
> $ make drivers/soc/litex/litex_soc_ctrl.o 
>   CALL    scripts/checksyscalls.sh
>   CALL    scripts/atomic/check-atomics.sh
>   DESCEND  objtool
>   CC      drivers/soc/litex/litex_soc_ctrl.o
> 
> Also, I can see litex_soc_ctrl_of_match is used.  I am not sure what is going on
> here.
> 
> -Stafford
> 

You need W=1

$ make -skj"$(nproc)" W=1 olddefconfig drivers/soc/litex/litex_soc_ctrl.o
drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: ‘litex_soc_ctrl_of_match’ defined but not used [-Wunused-const-variable=]
  143 | static const struct of_device_id litex_soc_ctrl_of_match[] = {
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~

$ rg "CONFIG_OF|CONFIG_LITEX_SOC_CONTROLLER" .config
1124:# CONFIG_OF is not set
4673:CONFIG_LITEX_SOC_CONTROLLER=y

This variable is used in two places in that file, in the
MODULE_DEVICE_TABLE macro and the of_match_ptr macro. When CONFIG_OF is
disabled, of_match_ptr evaluates to NULL. When the file is built into
the kernel image, MODULE_DEVICE_TABLE evaluates to nothing, leaving this
variable defined but unused in the final preprocessed source.

Hope that helps!

Cheers,
Nathan

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

* Re: drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match'
  2021-01-11 16:43   ` Nathan Chancellor
@ 2021-01-11 21:14       ` Stafford Horne
  0 siblings, 0 replies; 9+ messages in thread
From: Stafford Horne @ 2021-01-11 21:14 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: kernel test robot, Pawel Czarnecki, kbuild-all,
	clang-built-linux, linux-kernel, Mateusz Holenko

On Mon, Jan 11, 2021 at 09:43:34AM -0700, Nathan Chancellor wrote:
> On Mon, Jan 11, 2021 at 09:30:55PM +0900, Stafford Horne wrote:
> > On Thu, Jan 07, 2021 at 04:04:47AM +0800, kernel test robot wrote:
> > > Hi Pawel,
> > > 
> > > FYI, the error/warning still remains.
> > > 
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > head:   e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
> > > commit: 22447a99c97e353bde8f90c2353873f27681d57c drivers/soc/litex: add LiteX SoC Controller driver
> > > date:   8 weeks ago
> > > config: x86_64-randconfig-a001-20210107 (attached as .config)
> > > compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5c951623bc8965fa1e89660f2f5f4a2944e4981a)
> > > 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 x86_64 cross compiling tool for clang build
> > >         # apt-get install binutils-x86-64-linux-gnu
> > >         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=22447a99c97e353bde8f90c2353873f27681d57c
> > >         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > >         git fetch --no-tags linus master
> > >         git checkout 22447a99c97e353bde8f90c2353873f27681d57c
> > >         # save the attached .config to linux build tree
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
> > > 
> > > 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/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match' [-Wunused-const-variable]
> > >    static const struct of_device_id litex_soc_ctrl_of_match[] = {
> > >                                     ^
> > >    1 warning generated.
> > > 
> > > 
> > > vim +/litex_soc_ctrl_of_match +143 drivers/soc/litex/litex_soc_ctrl.c
> > > 
> > >    142	
> > >  > 143	static const struct of_device_id litex_soc_ctrl_of_match[] = {
> > >    144		{.compatible = "litex,soc-controller"},
> > >    145		{},
> > >    146	};
> > >    147	
> > > 
> > 
> > I don't use clang but GCC, and I cannot reproduce this warning.
> > 
> > $ make drivers/soc/litex/litex_soc_ctrl.o 
> >   CALL    scripts/checksyscalls.sh
> >   CALL    scripts/atomic/check-atomics.sh
> >   DESCEND  objtool
> >   CC      drivers/soc/litex/litex_soc_ctrl.o
> > 
> > Also, I can see litex_soc_ctrl_of_match is used.  I am not sure what is going on
> > here.
> > 
> > -Stafford
> > 
> 
> You need W=1
> 
> $ make -skj"$(nproc)" W=1 olddefconfig drivers/soc/litex/litex_soc_ctrl.o
> drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: ‘litex_soc_ctrl_of_match’ defined but not used [-Wunused-const-variable=]
>   143 | static const struct of_device_id litex_soc_ctrl_of_match[] = {
>       |                                  ^~~~~~~~~~~~~~~~~~~~~~~
> 
> $ rg "CONFIG_OF|CONFIG_LITEX_SOC_CONTROLLER" .config
> 1124:# CONFIG_OF is not set
> 4673:CONFIG_LITEX_SOC_CONTROLLER=y
> 
> This variable is used in two places in that file, in the
> MODULE_DEVICE_TABLE macro and the of_match_ptr macro. When CONFIG_OF is
> disabled, of_match_ptr evaluates to NULL. When the file is built into
> the kernel image, MODULE_DEVICE_TABLE evaluates to nothing, leaving this
> variable defined but unused in the final preprocessed source.
> 
> Hope that helps!

That helps, I noticed it was only used in those macros so that was fishy.  I
forgot to add W=1.

We will need to surround the definition in:

#if defined(CONFIG_OF)
#endif /* CONFIG_OF */

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

* Re: drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match'
@ 2021-01-11 21:14       ` Stafford Horne
  0 siblings, 0 replies; 9+ messages in thread
From: Stafford Horne @ 2021-01-11 21:14 UTC (permalink / raw)
  To: kbuild-all

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

On Mon, Jan 11, 2021 at 09:43:34AM -0700, Nathan Chancellor wrote:
> On Mon, Jan 11, 2021 at 09:30:55PM +0900, Stafford Horne wrote:
> > On Thu, Jan 07, 2021 at 04:04:47AM +0800, kernel test robot wrote:
> > > Hi Pawel,
> > > 
> > > FYI, the error/warning still remains.
> > > 
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > head:   e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
> > > commit: 22447a99c97e353bde8f90c2353873f27681d57c drivers/soc/litex: add LiteX SoC Controller driver
> > > date:   8 weeks ago
> > > config: x86_64-randconfig-a001-20210107 (attached as .config)
> > > compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5c951623bc8965fa1e89660f2f5f4a2944e4981a)
> > > 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 x86_64 cross compiling tool for clang build
> > >         # apt-get install binutils-x86-64-linux-gnu
> > >         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=22447a99c97e353bde8f90c2353873f27681d57c
> > >         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > >         git fetch --no-tags linus master
> > >         git checkout 22447a99c97e353bde8f90c2353873f27681d57c
> > >         # save the attached .config to linux build tree
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
> > > 
> > > 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/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match' [-Wunused-const-variable]
> > >    static const struct of_device_id litex_soc_ctrl_of_match[] = {
> > >                                     ^
> > >    1 warning generated.
> > > 
> > > 
> > > vim +/litex_soc_ctrl_of_match +143 drivers/soc/litex/litex_soc_ctrl.c
> > > 
> > >    142	
> > >  > 143	static const struct of_device_id litex_soc_ctrl_of_match[] = {
> > >    144		{.compatible = "litex,soc-controller"},
> > >    145		{},
> > >    146	};
> > >    147	
> > > 
> > 
> > I don't use clang but GCC, and I cannot reproduce this warning.
> > 
> > $ make drivers/soc/litex/litex_soc_ctrl.o 
> >   CALL    scripts/checksyscalls.sh
> >   CALL    scripts/atomic/check-atomics.sh
> >   DESCEND  objtool
> >   CC      drivers/soc/litex/litex_soc_ctrl.o
> > 
> > Also, I can see litex_soc_ctrl_of_match is used.  I am not sure what is going on
> > here.
> > 
> > -Stafford
> > 
> 
> You need W=1
> 
> $ make -skj"$(nproc)" W=1 olddefconfig drivers/soc/litex/litex_soc_ctrl.o
> drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: ‘litex_soc_ctrl_of_match’ defined but not used [-Wunused-const-variable=]
>   143 | static const struct of_device_id litex_soc_ctrl_of_match[] = {
>       |                                  ^~~~~~~~~~~~~~~~~~~~~~~
> 
> $ rg "CONFIG_OF|CONFIG_LITEX_SOC_CONTROLLER" .config
> 1124:# CONFIG_OF is not set
> 4673:CONFIG_LITEX_SOC_CONTROLLER=y
> 
> This variable is used in two places in that file, in the
> MODULE_DEVICE_TABLE macro and the of_match_ptr macro. When CONFIG_OF is
> disabled, of_match_ptr evaluates to NULL. When the file is built into
> the kernel image, MODULE_DEVICE_TABLE evaluates to nothing, leaving this
> variable defined but unused in the final preprocessed source.
> 
> Hope that helps!

That helps, I noticed it was only used in those macros so that was fishy.  I
forgot to add W=1.

We will need to surround the definition in:

#if defined(CONFIG_OF)
#endif /* CONFIG_OF */

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

* drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match'
@ 2020-12-27  0:47 ` kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2020-12-27  0:47 UTC (permalink / raw)
  To: Pawel Czarnecki
  Cc: kbuild-all, clang-built-linux, linux-kernel, Stafford Horne,
	Mateusz Holenko

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

Hi Pawel,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f838f8d2b694cf9d524dc4423e9dd2db13892f3f
commit: 22447a99c97e353bde8f90c2353873f27681d57c drivers/soc/litex: add LiteX SoC Controller driver
date:   7 weeks ago
config: arm-randconfig-r011-20201220 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=22447a99c97e353bde8f90c2353873f27681d57c
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 22447a99c97e353bde8f90c2353873f27681d57c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

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/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match' [-Wunused-const-variable]
   static const struct of_device_id litex_soc_ctrl_of_match[] = {
                                    ^
   1 warning generated.


vim +/litex_soc_ctrl_of_match +143 drivers/soc/litex/litex_soc_ctrl.c

   142	
 > 143	static const struct of_device_id litex_soc_ctrl_of_match[] = {
   144		{.compatible = "litex,soc-controller"},
   145		{},
   146	};
   147	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 23423 bytes --]

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

* drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match'
@ 2020-12-27  0:47 ` kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2020-12-27  0:47 UTC (permalink / raw)
  To: kbuild-all

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

Hi Pawel,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f838f8d2b694cf9d524dc4423e9dd2db13892f3f
commit: 22447a99c97e353bde8f90c2353873f27681d57c drivers/soc/litex: add LiteX SoC Controller driver
date:   7 weeks ago
config: arm-randconfig-r011-20201220 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=22447a99c97e353bde8f90c2353873f27681d57c
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 22447a99c97e353bde8f90c2353873f27681d57c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

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/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match' [-Wunused-const-variable]
   static const struct of_device_id litex_soc_ctrl_of_match[] = {
                                    ^
   1 warning generated.


vim +/litex_soc_ctrl_of_match +143 drivers/soc/litex/litex_soc_ctrl.c

   142	
 > 143	static const struct of_device_id litex_soc_ctrl_of_match[] = {
   144		{.compatible = "litex,soc-controller"},
   145		{},
   146	};
   147	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 23423 bytes --]

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

end of thread, other threads:[~2021-01-11 21:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 20:04 drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match' kernel test robot
2021-01-06 20:04 ` kernel test robot
2021-01-11 12:30 ` Stafford Horne
2021-01-11 12:30   ` Stafford Horne
2021-01-11 16:43   ` Nathan Chancellor
2021-01-11 21:14     ` Stafford Horne
2021-01-11 21:14       ` Stafford Horne
  -- strict thread matches above, loose matches on Subject: below --
2020-12-27  0:47 kernel test robot
2020-12-27  0:47 ` 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.