lkml.org 
[lkml]   [2022]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: sound/soc/codecs/src4xxx-i2c.c:28:34: warning: unused variable 'src4xxx_of_match'
Hi Matt,

On Fri, Oct 07, 2022 at 10:51:11AM +1100, Matt Flax wrote:
> Hi all,
>
> Can this test system be updated to catch of_match_ptr usage ?

of_match_ptr() evaluates to NULL when CONFIG_OF is not enabled, which
means the compiler cannot see that the variable was used in the macro
after preprocessing. Additionally, if this driver is built into the
kernel (i.e., when MODULE is not set), MODULE_DEVICE_TABLE() is defined
as an empty macro. These two situations together cause the warning:

$ curl -LSs https://lore.kernel.org/llvm/202210070151.yWxzUNdm-lkp@intel.com/2-config | rg "CONFIG_(OF|SND_SOC_SRC4XXX_I2C)"
# CONFIG_OF is not set
CONFIG_SND_SOC_SRC4XXX_I2C=y

Making of_patch_ptr() match pm_sleep_ptr() would resolve this warning
for this driver and many more. I have gone ahead and send a patch for
this (and put you on cc):

https://lore.kernel.org/20221013195153.2767632-1-nathan@kernel.org/

Cheers,
Nathan

> Here is the decleration :
>
> static const struct of_device_id src4xxx_of_match[] = {
>     { .compatible = "ti,src4392", },
>     { }
> };
> MODULE_DEVICE_TABLE(of, src4xxx_of_match);
>
> Here is the usage (in the same file) :
>
> static struct i2c_driver src4xxx_i2c_driver = {
>     .driver = {
>         .name = "src4xxx",
>         .of_match_table = of_match_ptr(src4xxx_of_match),
>
>
> On 7/10/22 04:21, kernel test robot wrote:
> > Hi Matt,
> >
> > FYI, the error/warning still remains.
> >
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: 833477fce7a14d43ae4c07f8ddc32fa5119471a2
> > commit: 4e6bedd3c396014ba70de2b4c9995c8e024e82b3 ASoC: codecs: add support for the TI SRC4392 codec
> > date: 8 weeks ago
> > config: hexagon-randconfig-r045-20221006
> > 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
> > # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4e6bedd3c396014ba70de2b4c9995c8e024e82b3
> > git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > git fetch --no-tags linus master
> > git checkout 4e6bedd3c396014ba70de2b4c9995c8e024e82b3
> > # 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=hexagon SHELL=/bin/bash sound/soc/codecs/
> >
> > If you fix the issue, kindly add following tag where applicable
> > | Reported-by: kernel test robot <lkp@intel.com>
> >
> > All warnings (new ones prefixed by >>):
> >
> > > > sound/soc/codecs/src4xxx-i2c.c:28:34: warning: unused variable 'src4xxx_of_match' [-Wunused-const-variable]
> > static const struct of_device_id src4xxx_of_match[] = {
> > ^
> > 1 warning generated.
> >
> >
> > vim +/src4xxx_of_match +28 sound/soc/codecs/src4xxx-i2c.c
> >
> > 27
> > > 28 static const struct of_device_id src4xxx_of_match[] = {
> > 29 { .compatible = "ti,src4392", },
> > 30 { }
> > 31 };
> > 32 MODULE_DEVICE_TABLE(of, src4xxx_of_match);
> > 33
> > 34
> >
>

\
 
 \ /
  Last update: 2022-10-13 21:54    [W:1.590 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site