All of lore.kernel.org
 help / color / mirror / Atom feed
* [intel-lts:5.10/yocto 6/8] drivers/soundwire/bus.c:1427:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-04-23 19:02 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-04-23 19:02 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
TO: "Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>
CC: nanli2x <nanx.li@intel.com>
CC: Rander Wang <rander.wang@linux.intel.com>
CC: Bard Liao <yung-chuan.liao@linux.intel.com>

tree:   https://github.com/intel/linux-intel-lts.git 5.10/yocto
head:   6410aba3b60feba47b9713f297d9b3bdb79981f5
commit: 99d62cba396dc2c733c62b8ffd1dde7ddc6701d3 [6/8] soundwire: bus: use no_pm IO routines for all interrupt handling
:::::: branch date: 4 days ago
:::::: commit date: 11 days ago
config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220424/202204240207.yNegEpOx-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5bd87350a5ae429baf8f373cb226a57b62f87280)
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/intel/linux-intel-lts/commit/99d62cba396dc2c733c62b8ffd1dde7ddc6701d3
        git remote add intel-lts https://github.com/intel/linux-intel-lts.git
        git fetch --no-tags intel-lts 5.10/yocto
        git checkout 99d62cba396dc2c733c62b8ffd1dde7ddc6701d3
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 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 >>)
   Suppressed 5 warnings (5 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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   6 warnings generated.
   sound/soc/codecs/sti-sas.c:430:7: warning: Access to field 'data' results in a dereference of a null pointer (loaded from variable 'of_id') [clang-analyzer-core.NullDereference]
           if (!of_id->data) {
                ^~~~~
   sound/soc/codecs/sti-sas.c:425:6: note: Assuming 'drvdata' is non-null
           if (!drvdata)
               ^~~~~~~~
   sound/soc/codecs/sti-sas.c:425:2: note: Taking false branch
           if (!drvdata)
           ^
   sound/soc/codecs/sti-sas.c:429:2: note: Null pointer value stored to 'of_id'
           of_id = of_match_node(sti_sas_dev_match, pnode);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/sti-sas.c:430:7: note: Access to field 'data' results in a dereference of a null pointer (loaded from variable 'of_id')
           if (!of_id->data) {
                ^~~~~
   Suppressed 5 warnings (5 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.
   6 warnings generated.
   sound/soc/codecs/tas2764.c:54:23: warning: Value stored to 'tas2764' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component);
                                ^~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/tas2764.c:54:23: note: Value stored to 'tas2764' during its initialization is never read
           struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component);
                                ^~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 5 warnings (5 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.
   7 warnings generated.
   Suppressed 7 warnings (7 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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   11 warnings generated.
   sound/soc/codecs/cs43130.c:179:8: warning: Excessive padding in 'struct cs43130_pll_params' (7 padding bytes, where 3 is optimal). 
   Optimal fields order: 
   pll_in, 
   pll_div_frac, 
   pll_out, 
   sclk_prediv, 
   pll_div_int, 
   pll_mode, 
   pll_divout, 
   pll_cal_ratio, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct cs43130_pll_params {
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs43130.c:179:8: note: Excessive padding in 'struct cs43130_pll_params' (7 padding bytes, where 3 is optimal). Optimal fields order: pll_in, pll_div_frac, pll_out, sclk_prediv, pll_div_int, pll_mode, pll_divout, pll_cal_ratio, consider reordering the fields or adding explicit padding members
   struct cs43130_pll_params {
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs43130.c:1937:28: warning: Value stored to 'component' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct snd_soc_component *component = cs43130->component;
                                     ^~~~~~~~~   ~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs43130.c:1937:28: note: Value stored to 'component' during its initialization is never read
           struct snd_soc_component *component = cs43130->component;
                                     ^~~~~~~~~   ~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs43130.c:2472:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = regmap_read(cs43130->regmap, CS43130_DEVID_AB, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs43130.c:2472:2: note: Value stored to 'ret' is never read
           ret = regmap_read(cs43130->regmap, CS43130_DEVID_AB, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs43130.c:2475:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = regmap_read(cs43130->regmap, CS43130_DEVID_CD, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs43130.c:2475:2: note: Value stored to 'ret' is never read
           ret = regmap_read(cs43130->regmap, CS43130_DEVID_CD, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs43130.c:2477:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = regmap_read(cs43130->regmap, CS43130_DEVID_E, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs43130.c:2477:2: note: Value stored to 'ret' is never read
           ret = regmap_read(cs43130->regmap, CS43130_DEVID_E, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 6 warnings (6 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.
   7 warnings generated.
   Suppressed 7 warnings (7 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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   5 warnings generated.
>> drivers/soundwire/bus.c:1427:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                   ret = sdw_write(slave, addr, clear);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/soundwire/bus.c:1427:3: note: Value stored to 'ret' is never read
                   ret = sdw_write(slave, addr, clear);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 4 warnings (4 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   Suppressed 3 warnings (3 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.
   7 warnings generated.
   drivers/soundwire/stream.c:847:10: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
                           kfree(bus->defer_msg.msg->buf);
                                 ^
   drivers/soundwire/stream.c:1755:6: note: Assuming 'stream' is non-null
           if (!stream) {
               ^~~~~~~
   drivers/soundwire/stream.c:1755:2: note: Taking false branch
           if (!stream) {
           ^
   drivers/soundwire/stream.c:1762:6: note: Assuming field 'state' is equal to SDW_STREAM_ENABLED
           if (stream->state != SDW_STREAM_ENABLED) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/soundwire/stream.c:1762:2: note: Taking false branch
           if (stream->state != SDW_STREAM_ENABLED) {
           ^
   drivers/soundwire/stream.c:1769:8: note: Calling '_sdw_disable_stream'
           ret = _sdw_disable_stream(stream);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/soundwire/stream.c:1700:2: note: Left side of '&&' is false
           list_for_each_entry(m_rt, &stream->master_list, stream_node) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:853:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/soundwire/stream.c:1700:2: note: Taking false branch
           list_for_each_entry(m_rt, &stream->master_list, stream_node) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:295:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/soundwire/stream.c:1700:2: note: Loop condition is false.  Exiting loop
           list_for_each_entry(m_rt, &stream->master_list, stream_node) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:293:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/soundwire/stream.c:1700:2: note: Loop condition is false. Execution continues on line 1710
           list_for_each_entry(m_rt, &stream->master_list, stream_node) {
           ^
   include/linux/list.h:628:2: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
           ^

vim +/ret +1427 drivers/soundwire/bus.c

b0a9c37b0178bf Vinod Koul           2017-12-14  1383  
b0a9c37b0178bf Vinod Koul           2017-12-14  1384  static int sdw_handle_port_interrupt(struct sdw_slave *slave,
b0a9c37b0178bf Vinod Koul           2017-12-14  1385  				     int port, u8 *slave_status)
b0a9c37b0178bf Vinod Koul           2017-12-14  1386  {
b0a9c37b0178bf Vinod Koul           2017-12-14  1387  	u8 clear = 0, impl_int_mask;
b0a9c37b0178bf Vinod Koul           2017-12-14  1388  	int status, status2, ret, count = 0;
b0a9c37b0178bf Vinod Koul           2017-12-14  1389  	u32 addr;
b0a9c37b0178bf Vinod Koul           2017-12-14  1390  
b0a9c37b0178bf Vinod Koul           2017-12-14  1391  	if (port == 0)
b0a9c37b0178bf Vinod Koul           2017-12-14  1392  		return sdw_handle_dp0_interrupt(slave, slave_status);
b0a9c37b0178bf Vinod Koul           2017-12-14  1393  
b0a9c37b0178bf Vinod Koul           2017-12-14  1394  	addr = SDW_DPN_INT(port);
99d62cba396dc2 Pierre-Louis Bossart 2021-01-22  1395  	status = sdw_read_no_pm(slave, addr);
b0a9c37b0178bf Vinod Koul           2017-12-14  1396  	if (status < 0) {
60d3d1770d7321 Pierre-Louis Bossart 2021-01-22  1397  		dev_err(&slave->dev,
17ed5bef49f42e Pierre-Louis Bossart 2019-05-01  1398  			"SDW_DPN_INT read failed:%d\n", status);
b0a9c37b0178bf Vinod Koul           2017-12-14  1399  
b0a9c37b0178bf Vinod Koul           2017-12-14  1400  		return status;
b0a9c37b0178bf Vinod Koul           2017-12-14  1401  	}
b0a9c37b0178bf Vinod Koul           2017-12-14  1402  
b0a9c37b0178bf Vinod Koul           2017-12-14  1403  	do {
b0a9c37b0178bf Vinod Koul           2017-12-14  1404  		if (status & SDW_DPN_INT_TEST_FAIL) {
17ed5bef49f42e Pierre-Louis Bossart 2019-05-01  1405  			dev_err(&slave->dev, "Test fail for port:%d\n", port);
b0a9c37b0178bf Vinod Koul           2017-12-14  1406  			clear |= SDW_DPN_INT_TEST_FAIL;
b0a9c37b0178bf Vinod Koul           2017-12-14  1407  		}
b0a9c37b0178bf Vinod Koul           2017-12-14  1408  
b0a9c37b0178bf Vinod Koul           2017-12-14  1409  		/*
b0a9c37b0178bf Vinod Koul           2017-12-14  1410  		 * Assumption: PORT_READY interrupt will be received only
b0a9c37b0178bf Vinod Koul           2017-12-14  1411  		 * for ports implementing CP_SM.
b0a9c37b0178bf Vinod Koul           2017-12-14  1412  		 */
b0a9c37b0178bf Vinod Koul           2017-12-14  1413  		if (status & SDW_DPN_INT_PORT_READY) {
b0a9c37b0178bf Vinod Koul           2017-12-14  1414  			complete(&slave->port_ready[port]);
b0a9c37b0178bf Vinod Koul           2017-12-14  1415  			clear |= SDW_DPN_INT_PORT_READY;
b0a9c37b0178bf Vinod Koul           2017-12-14  1416  		}
b0a9c37b0178bf Vinod Koul           2017-12-14  1417  
b0a9c37b0178bf Vinod Koul           2017-12-14  1418  		impl_int_mask = SDW_DPN_INT_IMPDEF1 |
b0a9c37b0178bf Vinod Koul           2017-12-14  1419  			SDW_DPN_INT_IMPDEF2 | SDW_DPN_INT_IMPDEF3;
b0a9c37b0178bf Vinod Koul           2017-12-14  1420  
b0a9c37b0178bf Vinod Koul           2017-12-14  1421  		if (status & impl_int_mask) {
b0a9c37b0178bf Vinod Koul           2017-12-14  1422  			clear |= impl_int_mask;
b0a9c37b0178bf Vinod Koul           2017-12-14  1423  			*slave_status = clear;
b0a9c37b0178bf Vinod Koul           2017-12-14  1424  		}
b0a9c37b0178bf Vinod Koul           2017-12-14  1425  
b0a9c37b0178bf Vinod Koul           2017-12-14  1426  		/* clear the interrupt */
b0a9c37b0178bf Vinod Koul           2017-12-14 @1427  		ret = sdw_write(slave, addr, clear);
99d62cba396dc2 Pierre-Louis Bossart 2021-01-22  1428  		/* clear the interrupt but don't touch reserved fields */
99d62cba396dc2 Pierre-Louis Bossart 2021-01-22  1429  		ret = sdw_write_no_pm(slave, addr, clear);
b0a9c37b0178bf Vinod Koul           2017-12-14  1430  		if (ret < 0) {
60d3d1770d7321 Pierre-Louis Bossart 2021-01-22  1431  			dev_err(&slave->dev,
17ed5bef49f42e Pierre-Louis Bossart 2019-05-01  1432  				"SDW_DPN_INT write failed:%d\n", ret);
b0a9c37b0178bf Vinod Koul           2017-12-14  1433  			return ret;
b0a9c37b0178bf Vinod Koul           2017-12-14  1434  		}
b0a9c37b0178bf Vinod Koul           2017-12-14  1435  
b0a9c37b0178bf Vinod Koul           2017-12-14  1436  		/* Read DPN interrupt again */
99d62cba396dc2 Pierre-Louis Bossart 2021-01-22  1437  		status2 = sdw_read_no_pm(slave, addr);
80cd8f0175d03f Wei Yongjun          2018-01-08  1438  		if (status2 < 0) {
60d3d1770d7321 Pierre-Louis Bossart 2021-01-22  1439  			dev_err(&slave->dev,
17ed5bef49f42e Pierre-Louis Bossart 2019-05-01  1440  				"SDW_DPN_INT read failed:%d\n", status2);
80cd8f0175d03f Wei Yongjun          2018-01-08  1441  			return status2;
b0a9c37b0178bf Vinod Koul           2017-12-14  1442  		}
b0a9c37b0178bf Vinod Koul           2017-12-14  1443  		status &= status2;
b0a9c37b0178bf Vinod Koul           2017-12-14  1444  
b0a9c37b0178bf Vinod Koul           2017-12-14  1445  		count++;
b0a9c37b0178bf Vinod Koul           2017-12-14  1446  
b0a9c37b0178bf Vinod Koul           2017-12-14  1447  		/* we can get alerts while processing so keep retrying */
b0a9c37b0178bf Vinod Koul           2017-12-14  1448  	} while (status != 0 && count < SDW_READ_INTR_CLEAR_RETRY);
b0a9c37b0178bf Vinod Koul           2017-12-14  1449  
b0a9c37b0178bf Vinod Koul           2017-12-14  1450  	if (count == SDW_READ_INTR_CLEAR_RETRY)
60d3d1770d7321 Pierre-Louis Bossart 2021-01-22  1451  		dev_warn(&slave->dev, "Reached MAX_RETRY on port read");
b0a9c37b0178bf Vinod Koul           2017-12-14  1452  
b0a9c37b0178bf Vinod Koul           2017-12-14  1453  	return ret;
b0a9c37b0178bf Vinod Koul           2017-12-14  1454  }
b0a9c37b0178bf Vinod Koul           2017-12-14  1455  

:::::: The code at line 1427 was first introduced by commit
:::::: b0a9c37b0178bf397393952e98789b0d4dc7fd6c soundwire: Add slave status handling

:::::: TO: Vinod Koul <vinod.koul@intel.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [intel-lts:5.10/yocto 6/8] drivers/soundwire/bus.c:1427:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-04-17  0:47 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-04-17  0:47 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
TO: "Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>
CC: nanli2x <nanx.li@intel.com>
CC: Rander Wang <rander.wang@linux.intel.com>
CC: Bard Liao <yung-chuan.liao@linux.intel.com>

tree:   https://github.com/intel/linux-intel-lts.git 5.10/yocto
head:   bc85b67a97aa2ce0c02aa7364781774f1766d952
commit: 99d62cba396dc2c733c62b8ffd1dde7ddc6701d3 [6/8] soundwire: bus: use no_pm IO routines for all interrupt handling
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220417/202204170827.Ytjc7trW-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 64c045e25b8471bbb572bd29159c294a82a86a25)
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/intel/linux-intel-lts/commit/99d62cba396dc2c733c62b8ffd1dde7ddc6701d3
        git remote add intel-lts https://github.com/intel/linux-intel-lts.git
        git fetch --no-tags intel-lts 5.10/yocto
        git checkout 99d62cba396dc2c733c62b8ffd1dde7ddc6701d3
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 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 >>)
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   12 warnings generated.
   fs/cifs/connect.c:4909:3: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
                   strcpy(bcc_ptr, tree);
                   ^~~~~~
   fs/cifs/connect.c:4909:3: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
                   strcpy(bcc_ptr, tree);
                   ^~~~~~
   fs/cifs/connect.c:4912:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(bcc_ptr, "?????");
           ^~~~~~
   fs/cifs/connect.c:4912:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
           strcpy(bcc_ptr, "?????");
           ^~~~~~
   Suppressed 10 warnings (10 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.
   7 warnings generated.
   sound/soc/codecs/cs42l56.c:1246:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = regmap_read(cs42l56->regmap, CS42L56_CHIP_ID_1, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs42l56.c:1246:2: note: Value stored to 'ret' is never read
           ret = regmap_read(cs42l56->regmap, CS42L56_CHIP_ID_1, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 6 warnings (6 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.
   9 warnings generated.
   sound/soc/codecs/cs42l73.c:1329:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_AB, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs42l73.c:1329:2: note: Value stored to 'ret' is never read
           ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_AB, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs42l73.c:1332:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_CD, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs42l73.c:1332:2: note: Value stored to 'ret' is never read
           ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_CD, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs42l73.c:1335:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_E, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/cs42l73.c:1335:2: note: Value stored to 'ret' is never read
           ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_E, &reg);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 6 warnings (6 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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   10 warnings generated.
   sound/soc/codecs/max98088.c:1441:8: warning: Value stored to 'best' is never read [clang-analyzer-deadcode.DeadStores]
          best = 0;
          ^      ~
   sound/soc/codecs/max98088.c:1441:8: note: Value stored to 'best' is never read
          best = 0;
          ^      ~
   sound/soc/codecs/max98088.c:1446:24: warning: Value stored to 'best' is never read [clang-analyzer-deadcode.DeadStores]
                          best = i;
                          ^      ~
   sound/soc/codecs/max98088.c:1446:24: note: Value stored to 'best' is never read
                          best = i;
                          ^      ~
   sound/soc/codecs/max98088.c:1488:8: warning: Value stored to 'best' is never read [clang-analyzer-deadcode.DeadStores]
          best = 0;
          ^      ~
   sound/soc/codecs/max98088.c:1488:8: note: Value stored to 'best' is never read
          best = 0;
          ^      ~
   sound/soc/codecs/max98088.c:1493:24: warning: Value stored to 'best' is never read [clang-analyzer-deadcode.DeadStores]
                          best = i;
                          ^      ~
   sound/soc/codecs/max98088.c:1493:24: note: Value stored to 'best' is never read
                          best = i;
                          ^      ~
   Suppressed 6 warnings (6 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   5 warnings generated.
>> drivers/soundwire/bus.c:1427:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                   ret = sdw_write(slave, addr, clear);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/soundwire/bus.c:1427:3: note: Value stored to 'ret' is never read
                   ret = sdw_write(slave, addr, clear);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 4 warnings (4 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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.
   7 warnings generated.
   Suppressed 7 warnings (7 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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   6 warnings generated.
   fs/ext2/dir.c:449:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = ext2_commit_chunk(page, pos, len);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ext2/dir.c:449:2: note: Value stored to 'err' is never read
           err = ext2_commit_chunk(page, pos, len);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 5 warnings (5 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   4 warnings generated.
   sound/soc/codecs/tlv320aic32x4-clk.c:39:8: warning: Excessive padding in 'struct aic32x4_clkdesc' (8 padding bytes, where 0 is optimal). 
   Optimal fields order: 
   name, 
   parent_names, 
   ops, 
   num_parents, 
   reg, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct aic32x4_clkdesc {
   ~~~~~~~^~~~~~~~~~~~~~~~~
   sound/soc/codecs/tlv320aic32x4-clk.c:39:8: note: Excessive padding in 'struct aic32x4_clkdesc' (8 padding bytes, where 0 is optimal). Optimal fields order: name, parent_names, ops, num_parents, reg, consider reordering the fields or adding explicit padding members
   struct aic32x4_clkdesc {
   ~~~~~~~^~~~~~~~~~~~~~~~~
   Suppressed 3 warnings (3 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   5 warnings generated.
   Suppressed 5 warnings (4 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   7 warnings generated.
   Suppressed 7 warnings (7 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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   8 warnings generated.
   sound/soc/codecs/wm8731.c:106:3: warning: Value stored to 'best' is never read [clang-analyzer-deadcode.DeadStores]
                   best = 0;
                   ^      ~
   sound/soc/codecs/wm8731.c:106:3: note: Value stored to 'best' is never read
                   best = 0;
                   ^      ~
   Suppressed 7 warnings (7 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.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).

vim +/ret +1427 drivers/soundwire/bus.c

b0a9c37b0178bf Vinod Koul           2017-12-14  1383  
b0a9c37b0178bf Vinod Koul           2017-12-14  1384  static int sdw_handle_port_interrupt(struct sdw_slave *slave,
b0a9c37b0178bf Vinod Koul           2017-12-14  1385  				     int port, u8 *slave_status)
b0a9c37b0178bf Vinod Koul           2017-12-14  1386  {
b0a9c37b0178bf Vinod Koul           2017-12-14  1387  	u8 clear = 0, impl_int_mask;
b0a9c37b0178bf Vinod Koul           2017-12-14  1388  	int status, status2, ret, count = 0;
b0a9c37b0178bf Vinod Koul           2017-12-14  1389  	u32 addr;
b0a9c37b0178bf Vinod Koul           2017-12-14  1390  
b0a9c37b0178bf Vinod Koul           2017-12-14  1391  	if (port == 0)
b0a9c37b0178bf Vinod Koul           2017-12-14  1392  		return sdw_handle_dp0_interrupt(slave, slave_status);
b0a9c37b0178bf Vinod Koul           2017-12-14  1393  
b0a9c37b0178bf Vinod Koul           2017-12-14  1394  	addr = SDW_DPN_INT(port);
99d62cba396dc2 Pierre-Louis Bossart 2021-01-22  1395  	status = sdw_read_no_pm(slave, addr);
b0a9c37b0178bf Vinod Koul           2017-12-14  1396  	if (status < 0) {
60d3d1770d7321 Pierre-Louis Bossart 2021-01-22  1397  		dev_err(&slave->dev,
17ed5bef49f42e Pierre-Louis Bossart 2019-05-01  1398  			"SDW_DPN_INT read failed:%d\n", status);
b0a9c37b0178bf Vinod Koul           2017-12-14  1399  
b0a9c37b0178bf Vinod Koul           2017-12-14  1400  		return status;
b0a9c37b0178bf Vinod Koul           2017-12-14  1401  	}
b0a9c37b0178bf Vinod Koul           2017-12-14  1402  
b0a9c37b0178bf Vinod Koul           2017-12-14  1403  	do {
b0a9c37b0178bf Vinod Koul           2017-12-14  1404  		if (status & SDW_DPN_INT_TEST_FAIL) {
17ed5bef49f42e Pierre-Louis Bossart 2019-05-01  1405  			dev_err(&slave->dev, "Test fail for port:%d\n", port);
b0a9c37b0178bf Vinod Koul           2017-12-14  1406  			clear |= SDW_DPN_INT_TEST_FAIL;
b0a9c37b0178bf Vinod Koul           2017-12-14  1407  		}
b0a9c37b0178bf Vinod Koul           2017-12-14  1408  
b0a9c37b0178bf Vinod Koul           2017-12-14  1409  		/*
b0a9c37b0178bf Vinod Koul           2017-12-14  1410  		 * Assumption: PORT_READY interrupt will be received only
b0a9c37b0178bf Vinod Koul           2017-12-14  1411  		 * for ports implementing CP_SM.
b0a9c37b0178bf Vinod Koul           2017-12-14  1412  		 */
b0a9c37b0178bf Vinod Koul           2017-12-14  1413  		if (status & SDW_DPN_INT_PORT_READY) {
b0a9c37b0178bf Vinod Koul           2017-12-14  1414  			complete(&slave->port_ready[port]);
b0a9c37b0178bf Vinod Koul           2017-12-14  1415  			clear |= SDW_DPN_INT_PORT_READY;
b0a9c37b0178bf Vinod Koul           2017-12-14  1416  		}
b0a9c37b0178bf Vinod Koul           2017-12-14  1417  
b0a9c37b0178bf Vinod Koul           2017-12-14  1418  		impl_int_mask = SDW_DPN_INT_IMPDEF1 |
b0a9c37b0178bf Vinod Koul           2017-12-14  1419  			SDW_DPN_INT_IMPDEF2 | SDW_DPN_INT_IMPDEF3;
b0a9c37b0178bf Vinod Koul           2017-12-14  1420  
b0a9c37b0178bf Vinod Koul           2017-12-14  1421  		if (status & impl_int_mask) {
b0a9c37b0178bf Vinod Koul           2017-12-14  1422  			clear |= impl_int_mask;
b0a9c37b0178bf Vinod Koul           2017-12-14  1423  			*slave_status = clear;
b0a9c37b0178bf Vinod Koul           2017-12-14  1424  		}
b0a9c37b0178bf Vinod Koul           2017-12-14  1425  
b0a9c37b0178bf Vinod Koul           2017-12-14  1426  		/* clear the interrupt */
b0a9c37b0178bf Vinod Koul           2017-12-14 @1427  		ret = sdw_write(slave, addr, clear);
99d62cba396dc2 Pierre-Louis Bossart 2021-01-22  1428  		/* clear the interrupt but don't touch reserved fields */
99d62cba396dc2 Pierre-Louis Bossart 2021-01-22  1429  		ret = sdw_write_no_pm(slave, addr, clear);
b0a9c37b0178bf Vinod Koul           2017-12-14  1430  		if (ret < 0) {
60d3d1770d7321 Pierre-Louis Bossart 2021-01-22  1431  			dev_err(&slave->dev,
17ed5bef49f42e Pierre-Louis Bossart 2019-05-01  1432  				"SDW_DPN_INT write failed:%d\n", ret);
b0a9c37b0178bf Vinod Koul           2017-12-14  1433  			return ret;
b0a9c37b0178bf Vinod Koul           2017-12-14  1434  		}
b0a9c37b0178bf Vinod Koul           2017-12-14  1435  
b0a9c37b0178bf Vinod Koul           2017-12-14  1436  		/* Read DPN interrupt again */
99d62cba396dc2 Pierre-Louis Bossart 2021-01-22  1437  		status2 = sdw_read_no_pm(slave, addr);
80cd8f0175d03f Wei Yongjun          2018-01-08  1438  		if (status2 < 0) {
60d3d1770d7321 Pierre-Louis Bossart 2021-01-22  1439  			dev_err(&slave->dev,
17ed5bef49f42e Pierre-Louis Bossart 2019-05-01  1440  				"SDW_DPN_INT read failed:%d\n", status2);
80cd8f0175d03f Wei Yongjun          2018-01-08  1441  			return status2;
b0a9c37b0178bf Vinod Koul           2017-12-14  1442  		}
b0a9c37b0178bf Vinod Koul           2017-12-14  1443  		status &= status2;
b0a9c37b0178bf Vinod Koul           2017-12-14  1444  
b0a9c37b0178bf Vinod Koul           2017-12-14  1445  		count++;
b0a9c37b0178bf Vinod Koul           2017-12-14  1446  
b0a9c37b0178bf Vinod Koul           2017-12-14  1447  		/* we can get alerts while processing so keep retrying */
b0a9c37b0178bf Vinod Koul           2017-12-14  1448  	} while (status != 0 && count < SDW_READ_INTR_CLEAR_RETRY);
b0a9c37b0178bf Vinod Koul           2017-12-14  1449  
b0a9c37b0178bf Vinod Koul           2017-12-14  1450  	if (count == SDW_READ_INTR_CLEAR_RETRY)
60d3d1770d7321 Pierre-Louis Bossart 2021-01-22  1451  		dev_warn(&slave->dev, "Reached MAX_RETRY on port read");
b0a9c37b0178bf Vinod Koul           2017-12-14  1452  
b0a9c37b0178bf Vinod Koul           2017-12-14  1453  	return ret;
b0a9c37b0178bf Vinod Koul           2017-12-14  1454  }
b0a9c37b0178bf Vinod Koul           2017-12-14  1455  

:::::: The code at line 1427 was first introduced by commit
:::::: b0a9c37b0178bf397393952e98789b0d4dc7fd6c soundwire: Add slave status handling

:::::: TO: Vinod Koul <vinod.koul@intel.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-23 19:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-23 19:02 [intel-lts:5.10/yocto 6/8] drivers/soundwire/bus.c:1427:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-04-17  0:47 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.