2023-11-05 05:03:49

by kernel test robot

[permalink] [raw]
Subject: drivers/mux/adg792a.c:134:34: warning: 'adg792a_of_match' defined but not used

Hi Chris,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: aea6bf908d730b01bd264a8821159db9463c111c
commit: e9e40543ad5b38b848879768359fd13650529961 spi: Add generic SPI multiplexer
date: 3 years, 9 months ago
config: i386-randconfig-004-20231101 (https://download.01.org/0day-ci/archive/20231105/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231105/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/mux/adg792a.c:134:34: warning: 'adg792a_of_match' defined but not used [-Wunused-const-variable=]
134 | static const struct of_device_id adg792a_of_match[] = {
| ^~~~~~~~~~~~~~~~


vim +/adg792a_of_match +134 drivers/mux/adg792a.c

afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 133
afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 @134 static const struct of_device_id adg792a_of_match[] = {
afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 135 { .compatible = "adi,adg792a", },
afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 136 { .compatible = "adi,adg792g", },
afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 137 { }
afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 138 };
afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 139 MODULE_DEVICE_TABLE(of, adg792a_of_match);
afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 140

:::::: The code at line 134 was first introduced by commit
:::::: afda08c4caa9489511557def51e322a5f2142a2f mux: adg792a: add mux controller driver for ADG792A/G

:::::: TO: Peter Rosin <[email protected]>
:::::: CC: Greg Kroah-Hartman <[email protected]>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


2023-11-05 20:09:00

by Chris Packham

[permalink] [raw]
Subject: Re: drivers/mux/adg792a.c:134:34: warning: 'adg792a_of_match' defined but not used


On 5/11/23 18:02, kernel test robot wrote:
> Hi Chris,
>
> First bad commit (maybe != root cause):
>
> tree: https://scanmail.trustwave.com/?c=20988&d=s6LH5Y7HiCJ1b6-4oP--FMP_NIoKokMD3iOna8wtMw&u=https%3a%2f%2fgit%2ekernel%2eorg%2fpub%2fscm%2flinux%2fkernel%2fgit%2ftorvalds%2flinux%2egit master
> head: aea6bf908d730b01bd264a8821159db9463c111c
> commit: e9e40543ad5b38b848879768359fd13650529961 spi: Add generic SPI multiplexer
> date: 3 years, 9 months ago
> config: i386-randconfig-004-20231101 (https://scanmail.trustwave.com/?c=20988&d=s6LH5Y7HiCJ1b6-4oP--FMP_NIoKokMD3nOja5wtNg&u=https%3a%2f%2fdownload%2e01%2eorg%2f0day-ci%2farchive%2f20231105%2f202311051347%2e7J6bthD7-lkp%40intel%2ecom%2fconfig)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce (this is a W=1 build): (https://scanmail.trustwave.com/?c=20988&d=s6LH5Y7HiCJ1b6-4oP--FMP_NIoKokMD3nGlbZkuYA&u=https%3a%2f%2fdownload%2e01%2eorg%2f0day-ci%2farchive%2f20231105%2f202311051347%2e7J6bthD7-lkp%40intel%2ecom%2freproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <[email protected]>
> | Closes: https://scanmail.trustwave.com/?c=20988&d=s6LH5Y7HiCJ1b6-4oP--FMP_NIoKokMD3imkZ8ssZQ&u=https%3a%2f%2flore%2ekernel%2eorg%2foe-kbuild-all%2f202311051347%2e7J6bthD7-lkp%40intel%2ecom%2f
>
> All warnings (new ones prefixed by >>):
>
>>> drivers/mux/adg792a.c:134:34: warning: 'adg792a_of_match' defined but not used [-Wunused-const-variable=]
> 134 | static const struct of_device_id adg792a_of_match[] = {
> | ^~~~~~~~~~~~~~~~
>
>
> vim +/adg792a_of_match +134 drivers/mux/adg792a.c
>
> afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 133
> afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 @134 static const struct of_device_id adg792a_of_match[] = {
> afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 135 { .compatible = "adi,adg792a", },
> afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 136 { .compatible = "adi,adg792g", },
> afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 137 { }
> afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 138 };
> afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 139 MODULE_DEVICE_TABLE(of, adg792a_of_match);
> afda08c4caa948 drivers/mux/mux-adg792a.c Peter Rosin 2017-05-14 140
>
> :::::: The code at line 134 was first introduced by commit
> :::::: afda08c4caa9489511557def51e322a5f2142a2f mux: adg792a: add mux controller driver for ADG792A/G
>
> :::::: TO: Peter Rosin <[email protected]>
> :::::: CC: Greg Kroah-Hartman <[email protected]>

I'm gonna go ahead and plead innocent on this one.

>

2023-11-06 18:07:54

by Andy Shevchenko

[permalink] [raw]
Subject: Re: drivers/mux/adg792a.c:134:34: warning: 'adg792a_of_match' defined but not used

(Resend to all)

On Sun, Nov 5, 2023 at 7:03 AM kernel test robot <[email protected]> wrote:
>
> Hi Chris,
>
> First bad commit (maybe != root cause):

Indeed.

>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: aea6bf908d730b01bd264a8821159db9463c111c
> commit: e9e40543ad5b38b848879768359fd13650529961 spi: Add generic SPI multiplexer
> date: 3 years, 9 months ago
> config: i386-randconfig-004-20231101 (https://download.01.org/0day-ci/archive/20231105/[email protected]/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231105/[email protected]/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <[email protected]>
> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/mux/adg792a.c:134:34: warning: 'adg792a_of_match' defined but not used [-Wunused-const-variable=]
> 134 | static const struct of_device_id adg792a_of_match[] = {
> | ^~~~~~~~~~~~~~~~
>

I dunno why it's pointing out to that commit and some (random?) people
in Cc list, but the real problem there from day 1, i.e. (ab)using
of_match_ptr(). The of_match_ptr() should not ever be used. It appears
more harmful than useful.

Hence the proper fix is to drop of_match_ptr() in this file.


> vim +/adg792a_of_match +134 drivers/mux/adg792a.c

--
With Best Regards,
Andy Shevchenko