[ammarfaizi2-block:axboe/linux-block/m1/2022-02-19 522/552] sound/soc/apple/mca.c:223:41: warning: array subscript 1 is above array bounds of 'bool[1]' {aka '_Bool[1]'}

From: kernel test robot
Date: Sun Feb 20 2022 - 07:29:48 EST


tree: https://github.com/ammarfaizi2/linux-block axboe/linux-block/m1/2022-02-19
head: b781e0ccdc0c9a931571d15db09d45b7258b9905
commit: aa68cd40e7ed6c63500d8ea9b8946e4d8c974f9c [522/552] ASoC: apple-mca: Add platform driver for Apple SoCs
config: xtensa-allyesconfig (https://download.01.org/0day-ci/archive/20220220/202202202036.km0KGsP8-lkp@xxxxxxxxx/config)
compiler: xtensa-linux-gcc (GCC) 11.2.0
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://github.com/ammarfaizi2/linux-block/commit/aa68cd40e7ed6c63500d8ea9b8946e4d8c974f9c
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block axboe/linux-block/m1/2022-02-19
git checkout aa68cd40e7ed6c63500d8ea9b8946e4d8c974f9c
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=xtensa SHELL=/bin/bash sound/soc/apple/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

sound/soc/apple/mca.c: In function 'mca_configure_serdes':
sound/soc/apple/mca.c:294:23: error: implicit declaration of function 'FIELD_PREP' [-Werror=implicit-function-declaration]
294 | serdes_conf = FIELD_PREP(SERDES_CONF_NCHANS, max(slots, 1) - 1);
| ^~~~~~~~~~
sound/soc/apple/mca.c: At top level:
sound/soc/apple/mca.c:776:6: warning: no previous prototype for 'apple_mca_release_dma_chans' [-Wmissing-prototypes]
776 | void apple_mca_release_dma_chans(struct mca_data *mca)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/apple/mca.c:791:6: warning: no previous prototype for 'apple_mca_put_clks' [-Wmissing-prototypes]
791 | void apple_mca_put_clks(struct mca_data *mca)
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/device.h:15,
from include/linux/platform_device.h:13,
from sound/soc/apple/mca.c:9:
sound/soc/apple/mca.c: In function 'apple_mca_probe':
sound/soc/apple/mca.c:917:45: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long int' [-Wformat=]
917 | dev_err(&pdev->dev, "unable to obtain clock %s: %d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
sound/soc/apple/mca.c:917:25: note: in expansion of macro 'dev_err'
917 | dev_err(&pdev->dev, "unable to obtain clock %s: %d\n",
| ^~~~~~~
sound/soc/apple/mca.c:917:74: note: format string is defined here
917 | dev_err(&pdev->dev, "unable to obtain clock %s: %d\n",
| ~^
| |
| int
| %ld
In file included from include/linux/device.h:15,
from include/linux/platform_device.h:13,
from sound/soc/apple/mca.c:9:
sound/soc/apple/mca.c:951:61: warning: format '%d' expects argument of type 'int', but argument 4 has type 'struct device_node *' [-Wformat=]
951 | dev_err(&pdev->dev, "no %s DMA channel: %d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
sound/soc/apple/mca.c:951:41: note: in expansion of macro 'dev_err'
951 | dev_err(&pdev->dev, "no %s DMA channel: %d\n",
| ^~~~~~~
sound/soc/apple/mca.c:951:82: note: format string is defined here
951 | dev_err(&pdev->dev, "no %s DMA channel: %d\n",
| ~^
| |
| int
In file included from include/linux/device.h:15,
from include/linux/platform_device.h:13,
from sound/soc/apple/mca.c:9:
sound/soc/apple/mca.c:951:61: warning: too many arguments for format [-Wformat-extra-args]
951 | dev_err(&pdev->dev, "no %s DMA channel: %d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
sound/soc/apple/mca.c:951:41: note: in expansion of macro 'dev_err'
951 | dev_err(&pdev->dev, "no %s DMA channel: %d\n",
| ^~~~~~~
sound/soc/apple/mca.c: In function 'mca_dai_set_sysclk':
>> sound/soc/apple/mca.c:223:41: warning: array subscript 1 is above array bounds of 'bool[1]' {aka '_Bool[1]'} [-Warray-bounds]
223 | if (route->clocks_in_use[stream])
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
sound/soc/apple/mca.c:123:14: note: while referencing 'clocks_in_use'
123 | bool clocks_in_use[SNDRV_PCM_STREAM_LAST];
| ^~~~~~~~~~~~~
sound/soc/apple/mca.c: In function 'mca_dai_hw_free':
>> sound/soc/apple/mca.c:223:41: warning: array subscript 1 is above array bounds of 'bool[1]' {aka '_Bool[1]'} [-Warray-bounds]
223 | if (route->clocks_in_use[stream])
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
sound/soc/apple/mca.c:123:14: note: while referencing 'clocks_in_use'
123 | bool clocks_in_use[SNDRV_PCM_STREAM_LAST];
| ^~~~~~~~~~~~~
sound/soc/apple/mca.c: In function 'mca_dai_prepare':
>> sound/soc/apple/mca.c:223:41: warning: array subscript 1 is above array bounds of 'bool[1]' {aka '_Bool[1]'} [-Warray-bounds]
223 | if (route->clocks_in_use[stream])
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
sound/soc/apple/mca.c:123:14: note: while referencing 'clocks_in_use'
123 | bool clocks_in_use[SNDRV_PCM_STREAM_LAST];
| ^~~~~~~~~~~~~
sound/soc/apple/mca.c: In function 'mca_dai_hw_params':
>> sound/soc/apple/mca.c:223:41: warning: array subscript 1 is above array bounds of 'bool[1]' {aka '_Bool[1]'} [-Warray-bounds]
223 | if (route->clocks_in_use[stream])
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
sound/soc/apple/mca.c:123:14: note: while referencing 'clocks_in_use'
123 | bool clocks_in_use[SNDRV_PCM_STREAM_LAST];
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +223 sound/soc/apple/mca.c

216
217
218 static bool mca_clocks_in_use(struct mca_route *route)
219 {
220 int stream;
221
222 for_each_pcm_streams(stream)
> 223 if (route->clocks_in_use[stream])
224 return true;
225 return false;
226 }
227

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