Re: drivers/ata/ahci_st.c:229:34: warning: unused variable 'st_ahci_match'
From: Damien Le Moal
Date: Thu Oct 13 2022 - 02:14:05 EST
On 10/12/22 15:37, kernel test robot wrote:
> Hi Damien,
>
> First bad commit (maybe != root cause):
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 49da070062390094112b423ba443ea193527b2e4
> commit: ecf8322f464d62759d838ea62cdeff6966a60134 ata: ahci_st: Enable compile test
> date: 3 weeks ago
> config: mips-randconfig-r023-20221012
> compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
> 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-mipsel-linux-gnu
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ecf8322f464d62759d838ea62cdeff6966a60134
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout ecf8322f464d62759d838ea62cdeff6966a60134
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/ata/
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
>>> drivers/ata/ahci_st.c:229:34: warning: unused variable 'st_ahci_match' [-Wunused-const-variable]
> static const struct of_device_id st_ahci_match[] = {
> ^
> 1 warning generated.
>
>
> vim +/st_ahci_match +229 drivers/ata/ahci_st.c
>
> 76884cb2f7da52 Lee Jones 2014-02-26 228
> 09de99db23df55 Kiran Padwal 2014-07-22 @229 static const struct of_device_id st_ahci_match[] = {
> 76884cb2f7da52 Lee Jones 2014-02-26 230 { .compatible = "st,ahci", },
> 5e776d7b20f040 Geert Uytterhoeven 2022-03-03 231 { /* sentinel */ }
> 76884cb2f7da52 Lee Jones 2014-02-26 232 };
> 76884cb2f7da52 Lee Jones 2014-02-26 233 MODULE_DEVICE_TABLE(of, st_ahci_match);
> 76884cb2f7da52 Lee Jones 2014-02-26 234
>
> :::::: The code at line 229 was first introduced by commit
> :::::: 09de99db23df55c7415d110f6c62281dedd77384 ahci: st: Make of_device_id array const
>
> :::::: TO: Kiran Padwal <kiran.padwal21@xxxxxxxxx>
> :::::: CC: Tejun Heo <tj@xxxxxxxxxx>
I am at a loss with this one... There are plenty of patterns similar to
drivers/ata/ahci_st.c doing something like:
static const struct of_device_id st_ahci_match[] = {
{ .compatible = "st,ahci", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, st_ahci_match);
For instance, in drivers/pwm/pwm-sti.c, we have:
static const struct of_device_id sti_pwm_of_match[] = {
{ .compatible = "st,sti-pwm", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, sti_pwm_of_match);
And countless others like this for STI and other arch too.
So if CONFIG_MODULE is not enabled, how come we are not submerged with
warnings about unused variables ? Is mips arch special in this regard ?
Or am I missing something ?
--
Damien Le Moal
Western Digital Research