Re: drivers/mux/adg792a.c:134:34: warning: 'adg792a_of_match' defined but not used
From: Andy Shevchenko
Date: Mon Nov 06 2023 - 13:07:43 EST
(Resend to all)
On Sun, Nov 5, 2023 at 7:03 AM kernel test robot <lkp@xxxxxxxxx> 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/202311051347.7J6bthD7-lkp@xxxxxxxxx/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/202311051347.7J6bthD7-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202311051347.7J6bthD7-lkp@xxxxxxxxx/
>
> 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