All of lore.kernel.org
 help / color / mirror / Atom feed
* sound/soc/codecs/rt715-sdca.c:359:25: warning: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'int' [clang-analyzer-core.UndefinedBinaryOperatorResult]
@ 2021-09-04 18:41 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-09-04 18:41 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 15967 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Jack Yu <jack.yu@realtek.com>
CC: Mark Brown <broonie@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f1583cb1be35c23df60b1c39e3e7e6704d749d0b
commit: 20d17057f0a8c7bfecfb9e05bd5ba33a100a9a15 ASoC: rt715-sdca: Add RT715 sdca vendor-specific driver
date:   6 months ago
:::::: branch date: 20 hours ago
:::::: commit date: 6 months ago
config: riscv-randconfig-c006-20210904 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1104e3258b5064e7110cc297e2cec60ac9acfc0a)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=20d17057f0a8c7bfecfb9e05bd5ba33a100a9a15
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 20d17057f0a8c7bfecfb9e05bd5ba33a100a9a15
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
           ^
   sound/soc/generic/simple-card.c:276:2: note: Taking false branch
           dev_dbg(dev, "link_of (%pOF)\n", node);
           ^
   include/linux/dev_printk.h:130:2: note: expanded from macro 'dev_dbg'
           if (0)                                                          \
           ^
   sound/soc/generic/simple-card.c:279:6: note: 'is_top' is false
           if (is_top)
               ^~~~~~
   sound/soc/generic/simple-card.c:279:2: note: Taking false branch
           if (is_top)
           ^
   sound/soc/generic/simple-card.c:292:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   sound/soc/generic/simple-card.c:292:2: note: Taking false branch
           if (ret < 0)
           ^
   sound/soc/generic/simple-card.c:297:8: note: Calling 'asoc_simple_parse_dai'
           ret = asoc_simple_parse_cpu(cpu, dai_link, &single_cpu);
                 ^
   include/sound/simple_card_utils.h:104:2: note: expanded from macro 'asoc_simple_parse_cpu'
           asoc_simple_parse_dai(node, dai_link->cpus, is_single_link)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/generic/simple-card.c:38:7: note: 'node' is non-null
           if (!node)
                ^~~~
   sound/soc/generic/simple-card.c:38:2: note: Taking false branch
           if (!node)
           ^
   sound/soc/generic/simple-card.c:46:6: note: Assuming 'ret' is not equal to 0
           if (ret)
               ^~~
   sound/soc/generic/simple-card.c:46:2: note: Taking true branch
           if (ret)
           ^
   sound/soc/generic/simple-card.c:47:3: note: Returning without writing to '*is_single_link'
                   return ret;
                   ^
   sound/soc/generic/simple-card.c:297:8: note: Returning from 'asoc_simple_parse_dai'
           ret = asoc_simple_parse_cpu(cpu, dai_link, &single_cpu);
                 ^
   include/sound/simple_card_utils.h:104:2: note: expanded from macro 'asoc_simple_parse_cpu'
           asoc_simple_parse_dai(node, dai_link->cpus, is_single_link)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/generic/simple-card.c:298:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   sound/soc/generic/simple-card.c:298:2: note: Taking false branch
           if (ret < 0)
           ^
   sound/soc/generic/simple-card.c:302:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   sound/soc/generic/simple-card.c:302:2: note: Taking false branch
           if (ret < 0)
           ^
   sound/soc/generic/simple-card.c:306:6: note: 'ret' is >= 0
           if (ret < 0)
               ^~~
   sound/soc/generic/simple-card.c:306:2: note: Taking false branch
           if (ret < 0)
           ^
   sound/soc/generic/simple-card.c:310:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   sound/soc/generic/simple-card.c:310:2: note: Taking false branch
           if (ret < 0)
           ^
   sound/soc/generic/simple-card.c:314:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   sound/soc/generic/simple-card.c:314:2: note: Taking false branch
           if (ret < 0)
           ^
   sound/soc/generic/simple-card.c:318:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   sound/soc/generic/simple-card.c:318:2: note: Taking false branch
           if (ret < 0)
           ^
   sound/soc/generic/simple-card.c:322:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   sound/soc/generic/simple-card.c:322:2: note: Taking false branch
           if (ret < 0)
           ^
   sound/soc/generic/simple-card.c:329:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   sound/soc/generic/simple-card.c:329:2: note: Taking false branch
           if (ret < 0)
           ^
   sound/soc/generic/simple-card.c:335:2: note: 2nd function call argument is an uninitialized value
           asoc_simple_canonicalize_cpu(dai_link, single_cpu);
           ^                                      ~~~~~~~~~~
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
>> sound/soc/codecs/rt715-sdca.c:359:25: warning: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'int' [clang-analyzer-core.UndefinedBinaryOperatorResult]
           unsigned int mask = (1 << fls(max)) - 1;
                                  ^  ~~~~~~~~
   sound/soc/codecs/rt715-sdca.c:359:28: note: Calling 'fls'
           unsigned int mask = (1 << fls(max)) - 1;
                                     ^~~~~~~~
   include/asm-generic/bitops/fls.h:15:2: note: 'r' initialized to 32
           int r = 32;
           ^~~~~
   include/asm-generic/bitops/fls.h:17:6: note: Assuming 'x' is not equal to 0, which participates in a condition later
           if (!x)
               ^~
   include/asm-generic/bitops/fls.h:17:2: note: Taking false branch
           if (!x)
           ^
   include/asm-generic/bitops/fls.h:19:6: note: Assuming the condition is false
           if (!(x & 0xffff0000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:19:2: note: Taking false branch
           if (!(x & 0xffff0000u)) {
           ^
   include/asm-generic/bitops/fls.h:23:6: note: Assuming the condition is false
           if (!(x & 0xff000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:23:2: note: Taking false branch
           if (!(x & 0xff000000u)) {
           ^
   include/asm-generic/bitops/fls.h:27:6: note: Assuming the condition is false
           if (!(x & 0xf0000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:27:2: note: Taking false branch
           if (!(x & 0xf0000000u)) {
           ^
   include/asm-generic/bitops/fls.h:31:6: note: Assuming the condition is false
           if (!(x & 0xc0000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:31:2: note: Taking false branch
           if (!(x & 0xc0000000u)) {
           ^
   include/asm-generic/bitops/fls.h:35:6: note: Assuming the condition is false
           if (!(x & 0x80000000u)) {
               ^~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/fls.h:35:2: note: Taking false branch
           if (!(x & 0x80000000u)) {
           ^
   include/asm-generic/bitops/fls.h:39:2: note: Returning the value 32 (loaded from 'r')
           return r;
           ^~~~~~~~
   sound/soc/codecs/rt715-sdca.c:359:28: note: Returning from 'fls'
           unsigned int mask = (1 << fls(max)) - 1;
                                     ^~~~~~~~
   sound/soc/codecs/rt715-sdca.c:359:25: note: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'int'
           unsigned int mask = (1 << fls(max)) - 1;
                                  ^  ~~~~~~~~
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   drivers/mtd/lpddr/lpddr_cmds.c:441:24: warning: The left operand of '-' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   if (n > vec->iov_len - vec_seek)
                                        ^
   drivers/mtd/lpddr/lpddr_cmds.c:641:9: note: Calling 'lpddr_writev'
           return lpddr_writev(mtd, &vec, 1, to, retlen);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/lpddr/lpddr_cmds.c:656:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < count; i++)
           ^
   drivers/mtd/lpddr/lpddr_cmds.c:656:2: note: Loop condition is false. Execution continues on line 659
   drivers/mtd/lpddr/lpddr_cmds.c:659:6: note: Assuming 'len' is not equal to 0
           if (!len)
               ^~~~
   drivers/mtd/lpddr/lpddr_cmds.c:659:2: note: Taking false branch

vim +359 sound/soc/codecs/rt715-sdca.c

20d17057f0a8c7 Jack Yu 2021-03-02  347  
20d17057f0a8c7 Jack Yu 2021-03-02  348  static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,
20d17057f0a8c7 Jack Yu 2021-03-02  349  	struct snd_ctl_elem_value *ucontrol)
20d17057f0a8c7 Jack Yu 2021-03-02  350  {
20d17057f0a8c7 Jack Yu 2021-03-02  351  	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
20d17057f0a8c7 Jack Yu 2021-03-02  352  	struct rt715_sdca_priv *rt715 = snd_soc_component_get_drvdata(component);
20d17057f0a8c7 Jack Yu 2021-03-02  353  	struct rt715_sdca_kcontrol_private *p =
20d17057f0a8c7 Jack Yu 2021-03-02  354  		(struct rt715_sdca_kcontrol_private *)kcontrol->private_value;
20d17057f0a8c7 Jack Yu 2021-03-02  355  	unsigned int val[4] = {0}, val_mask, i, k_changed = 0;
20d17057f0a8c7 Jack Yu 2021-03-02  356  	unsigned int reg = p->reg_base;
20d17057f0a8c7 Jack Yu 2021-03-02  357  	unsigned int shift = p->shift;
20d17057f0a8c7 Jack Yu 2021-03-02  358  	unsigned int max = p->max;
20d17057f0a8c7 Jack Yu 2021-03-02 @359  	unsigned int mask = (1 << fls(max)) - 1;
20d17057f0a8c7 Jack Yu 2021-03-02  360  	unsigned int invert = p->invert;
20d17057f0a8c7 Jack Yu 2021-03-02  361  	int err;
20d17057f0a8c7 Jack Yu 2021-03-02  362  
20d17057f0a8c7 Jack Yu 2021-03-02  363  	for (i = 0; i < 4; i++) {
20d17057f0a8c7 Jack Yu 2021-03-02  364  		if (ucontrol->value.integer.value[i] != rt715->kctl_switch_orig[i]) {
20d17057f0a8c7 Jack Yu 2021-03-02  365  			k_changed = 1;
20d17057f0a8c7 Jack Yu 2021-03-02  366  			break;
20d17057f0a8c7 Jack Yu 2021-03-02  367  		}
20d17057f0a8c7 Jack Yu 2021-03-02  368  	}
20d17057f0a8c7 Jack Yu 2021-03-02  369  
20d17057f0a8c7 Jack Yu 2021-03-02  370  	for (i = 0; i < 2; i++) {
20d17057f0a8c7 Jack Yu 2021-03-02  371  		rt715->kctl_switch_orig[i * 2] = ucontrol->value.integer.value[i * 2];
20d17057f0a8c7 Jack Yu 2021-03-02  372  		val[i * 2] = ucontrol->value.integer.value[i * 2] & mask;
20d17057f0a8c7 Jack Yu 2021-03-02  373  		if (invert)
20d17057f0a8c7 Jack Yu 2021-03-02  374  			val[i * 2] = max - val[i * 2];
20d17057f0a8c7 Jack Yu 2021-03-02  375  		val_mask = mask << shift;
20d17057f0a8c7 Jack Yu 2021-03-02  376  		val[i * 2] <<= shift;
20d17057f0a8c7 Jack Yu 2021-03-02  377  
20d17057f0a8c7 Jack Yu 2021-03-02  378  		rt715->kctl_switch_orig[i * 2 + 1] =
20d17057f0a8c7 Jack Yu 2021-03-02  379  			ucontrol->value.integer.value[i * 2 + 1];
20d17057f0a8c7 Jack Yu 2021-03-02  380  		val[i * 2 + 1] =
20d17057f0a8c7 Jack Yu 2021-03-02  381  			ucontrol->value.integer.value[i * 2 + 1] & mask;
20d17057f0a8c7 Jack Yu 2021-03-02  382  		if (invert)
20d17057f0a8c7 Jack Yu 2021-03-02  383  			val[i * 2 + 1] = max - val[i * 2 + 1];
20d17057f0a8c7 Jack Yu 2021-03-02  384  
20d17057f0a8c7 Jack Yu 2021-03-02  385  		val[i * 2 + 1] <<=  shift;
20d17057f0a8c7 Jack Yu 2021-03-02  386  
20d17057f0a8c7 Jack Yu 2021-03-02  387  		err = snd_soc_component_update_bits(component, reg + i * 2, val_mask,
20d17057f0a8c7 Jack Yu 2021-03-02  388  				val[i * 2]);
20d17057f0a8c7 Jack Yu 2021-03-02  389  		if (err < 0)
20d17057f0a8c7 Jack Yu 2021-03-02  390  			return err;
20d17057f0a8c7 Jack Yu 2021-03-02  391  
20d17057f0a8c7 Jack Yu 2021-03-02  392  		err = snd_soc_component_update_bits(component, reg + 1 + i * 2,
20d17057f0a8c7 Jack Yu 2021-03-02  393  			val_mask, val[i * 2 + 1]);
20d17057f0a8c7 Jack Yu 2021-03-02  394  		if (err < 0)
20d17057f0a8c7 Jack Yu 2021-03-02  395  			return err;
20d17057f0a8c7 Jack Yu 2021-03-02  396  	}
20d17057f0a8c7 Jack Yu 2021-03-02  397  
20d17057f0a8c7 Jack Yu 2021-03-02  398  	return k_changed;
20d17057f0a8c7 Jack Yu 2021-03-02  399  }
20d17057f0a8c7 Jack Yu 2021-03-02  400  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32325 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-04 18:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-04 18:41 sound/soc/codecs/rt715-sdca.c:359:25: warning: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'int' [clang-analyzer-core.UndefinedBinaryOperatorResult] kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.