All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/cxl/acpi.c:25:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-01-25 11:34 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-01-25 11:34 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Dan Williams <dan.j.williams@intel.com>
CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0
commit: 3b94ce7b7bc1b436465a93f19a50e0b495b429a1 cxl/acpi: Enumerate host bridge root ports
date:   8 months ago
:::::: branch date: 2 days ago
:::::: commit date: 8 months ago
config: x86_64-randconfig-c007-20220124 (https://download.01.org/0day-ci/archive/20220125/202201251919.qYokQb4N-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 7b3d30728816403d1fd73cc5082e9fb761262bce)
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=3b94ce7b7bc1b436465a93f19a50e0b495b429a1
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 3b94ce7b7bc1b436465a93f19a50e0b495b429a1
        # 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 >>)
   include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/i3c/master/svc-i3c-master.c:369:2: note: Control jumps to 'case 1:'  at line 370
           switch (ibitype) {
           ^
   drivers/i3c/master/svc-i3c-master.c:371:9: note: Calling 'svc_i3c_master_dev_from_addr'
                   dev = svc_i3c_master_dev_from_addr(master, ibiaddr);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i3c/master/svc-i3c-master.c:259:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < SVC_I3C_MAX_DEVS; i++)
           ^
   drivers/i3c/master/svc-i3c-master.c:260:7: note: Assuming the condition is false
                   if (master->addrs[i] == ibiaddr)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i3c/master/svc-i3c-master.c:260:3: note: Taking false branch
                   if (master->addrs[i] == ibiaddr)
                   ^
   drivers/i3c/master/svc-i3c-master.c:259:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < SVC_I3C_MAX_DEVS; i++)
           ^
   drivers/i3c/master/svc-i3c-master.c:260:7: note: Assuming the condition is false
                   if (master->addrs[i] == ibiaddr)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i3c/master/svc-i3c-master.c:260:3: note: Taking false branch
                   if (master->addrs[i] == ibiaddr)
                   ^
   drivers/i3c/master/svc-i3c-master.c:259:36: note: The value 2 is assigned to 'i'
           for (i = 0; i < SVC_I3C_MAX_DEVS; i++)
                                             ^~~
   drivers/i3c/master/svc-i3c-master.c:259:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < SVC_I3C_MAX_DEVS; i++)
           ^
   drivers/i3c/master/svc-i3c-master.c:260:7: note: Assuming the condition is true
                   if (master->addrs[i] == ibiaddr)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i3c/master/svc-i3c-master.c:260:3: note: Taking true branch
                   if (master->addrs[i] == ibiaddr)
                   ^
   drivers/i3c/master/svc-i3c-master.c:261:4: note:  Execution continues on line 263
                           break;
                           ^
   drivers/i3c/master/svc-i3c-master.c:263:6: note: 'i' is not equal to SVC_I3C_MAX_DEVS
           if (i == SVC_I3C_MAX_DEVS)
               ^
   drivers/i3c/master/svc-i3c-master.c:263:2: note: Taking false branch
           if (i == SVC_I3C_MAX_DEVS)
           ^
   drivers/i3c/master/svc-i3c-master.c:266:2: note: Returning without writing to 'master->ibi.tbq_slot', which participates in a condition later
           return master->descs[i];
           ^
   drivers/i3c/master/svc-i3c-master.c:266:2: note: Returning pointer
           return master->descs[i];
           ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/i3c/master/svc-i3c-master.c:371:9: note: Returning from 'svc_i3c_master_dev_from_addr'
                   dev = svc_i3c_master_dev_from_addr(master, ibiaddr);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i3c/master/svc-i3c-master.c:371:3: note: Value assigned to 'dev'
                   dev = svc_i3c_master_dev_from_addr(master, ibiaddr);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i3c/master/svc-i3c-master.c:372:7: note: Assuming 'dev' is null
                   if (!dev)
                       ^~~~
   drivers/i3c/master/svc-i3c-master.c:372:3: note: Taking true branch
                   if (!dev)
                   ^
   drivers/i3c/master/svc-i3c-master.c:373:4: note: Calling 'svc_i3c_master_nack_ibi'
                           svc_i3c_master_nack_ibi(master);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i3c/master/svc-i3c-master.c:337:1: note: Returning without writing to 'master->ibi.tbq_slot', which participates in a condition later
   }
   ^
   drivers/i3c/master/svc-i3c-master.c:373:4: note: Returning from 'svc_i3c_master_nack_ibi'
                           svc_i3c_master_nack_ibi(master);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i3c/master/svc-i3c-master.c:376:3: note:  Execution continues on line 392
                   break;
                   ^
   drivers/i3c/master/svc-i3c-master.c:392:6: note: Assuming the condition is true
           if (svc_i3c_master_error(master)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i3c/master/svc-i3c-master.c:392:2: note: Taking true branch
           if (svc_i3c_master_error(master)) {
           ^
   drivers/i3c/master/svc-i3c-master.c:393:7: note: Assuming field 'tbq_slot' is non-null
                   if (master->ibi.tbq_slot) {
                       ^~~~~~~~~~~~~~~~~~~~
   drivers/i3c/master/svc-i3c-master.c:393:3: note: Taking true branch
                   if (master->ibi.tbq_slot) {
                   ^
   drivers/i3c/master/svc-i3c-master.c:394:35: note: Passing null pointer value via 1st parameter 'dev'
                           data = i3c_dev_get_master_data(dev);
                                                          ^~~
   drivers/i3c/master/svc-i3c-master.c:394:11: note: Calling 'i3c_dev_get_master_data'
                           data = i3c_dev_get_master_data(dev);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/i3c/master.h:557:9: note: Dereference of null pointer
           return dev->common.master_priv;
                  ^~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.
>> drivers/cxl/acpi.c:25:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct device *dev = ctx->dev;
                          ^~~   ~~~~~~~~
   drivers/cxl/acpi.c:25:17: note: Value stored to 'dev' during its initialization is never read
           struct device *dev = ctx->dev;
                          ^~~   ~~~~~~~~
   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.
   1 warning generated.
   drivers/dma-buf/dma-resv.c:507:26: warning: Array access (from variable 'shared') results in a null pointer dereference [clang-analyzer-core.NullDereference]
                   shared[shared_count++] = fence_excl;
                   ~~~~~~                 ^
   drivers/dma-buf/dma-resv.c:437:2: note: 'shared' initialized to a null pointer value
           struct dma_fence **shared = NULL;
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/dma-buf/dma-resv.c:450:9: note: Loop condition is false. Execution continues on line 450
                   seq = read_seqcount_begin(&obj->seq);
                         ^
   include/linux/seqlock.h:363:2: note: expanded from macro 'read_seqcount_begin'
           raw_read_seqcount_begin(s);                                     \
           ^
   include/linux/seqlock.h:348:18: note: expanded from macro 'raw_read_seqcount_begin'
           unsigned _seq = __read_seqcount_begin(s);                       \
                           ^
   include/linux/seqlock.h:333:2: note: expanded from macro '__read_seqcount_begin'
           while ((__seq = seqprop_sequence(s)) & 1)                       \
           ^
   drivers/dma-buf/dma-resv.c:452:16: note: Left side of '||' is false
                   fence_excl = rcu_dereference(obj->fence_excl);
                                ^
   include/linux/rcupdate.h:572:28: note: expanded from macro 'rcu_dereference'
   #define rcu_dereference(p) rcu_dereference_check(p, 0)
                              ^
   include/linux/rcupdate.h:514:2: note: expanded from macro 'rcu_dereference_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
           ^
   include/linux/rcupdate.h:375:48: note: expanded from macro '__rcu_dereference_check'
           typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
                                                         ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   drivers/dma-buf/dma-resv.c:452:16: note: Left side of '||' is false
                   fence_excl = rcu_dereference(obj->fence_excl);
                                ^
   include/linux/rcupdate.h:572:28: note: expanded from macro 'rcu_dereference'
   #define rcu_dereference(p) rcu_dereference_check(p, 0)
                              ^
   include/linux/rcupdate.h:514:2: note: expanded from macro 'rcu_dereference_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
           ^
   include/linux/rcupdate.h:375:48: note: expanded from macro '__rcu_dereference_check'
           typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
                                                         ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   drivers/dma-buf/dma-resv.c:452:16: note: Left side of '||' is false
                   fence_excl = rcu_dereference(obj->fence_excl);
                                ^
   include/linux/rcupdate.h:572:28: note: expanded from macro 'rcu_dereference'
   #define rcu_dereference(p) rcu_dereference_check(p, 0)
                              ^
   include/linux/rcupdate.h:514:2: note: expanded from macro 'rcu_dereference_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
           ^
   include/linux/rcupdate.h:375:48: note: expanded from macro '__rcu_dereference_check'
           typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
                                                         ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   drivers/dma-buf/dma-resv.c:452:16: note: Left side of '||' is true
                   fence_excl = rcu_dereference(obj->fence_excl);
                                ^
   include/linux/rcupdate.h:572:28: note: expanded from macro 'rcu_dereference'
   #define rcu_dereference(p) rcu_dereference_check(p, 0)
                              ^
   include/linux/rcupdate.h:514:2: note: expanded from macro 'rcu_dereference_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
           ^
   include/linux/rcupdate.h:375:48: note: expanded from macro '__rcu_dereference_check'

vim +/dev +25 drivers/cxl/acpi.c

3b94ce7b7bc1b4 Dan Williams 2021-06-09  18  
3b94ce7b7bc1b4 Dan Williams 2021-06-09  19  static int match_add_root_ports(struct pci_dev *pdev, void *data)
3b94ce7b7bc1b4 Dan Williams 2021-06-09  20  {
3b94ce7b7bc1b4 Dan Williams 2021-06-09  21  	struct cxl_walk_context *ctx = data;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  22  	struct pci_bus *root_bus = ctx->root;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  23  	struct cxl_port *port = ctx->port;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  24  	int type = pci_pcie_type(pdev);
3b94ce7b7bc1b4 Dan Williams 2021-06-09 @25  	struct device *dev = ctx->dev;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  26  	u32 lnkcap, port_num;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  27  	int rc;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  28  
3b94ce7b7bc1b4 Dan Williams 2021-06-09  29  	if (pdev->bus != root_bus)
3b94ce7b7bc1b4 Dan Williams 2021-06-09  30  		return 0;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  31  	if (!pci_is_pcie(pdev))
3b94ce7b7bc1b4 Dan Williams 2021-06-09  32  		return 0;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  33  	if (type != PCI_EXP_TYPE_ROOT_PORT)
3b94ce7b7bc1b4 Dan Williams 2021-06-09  34  		return 0;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  35  	if (pci_read_config_dword(pdev, pci_pcie_cap(pdev) + PCI_EXP_LNKCAP,
3b94ce7b7bc1b4 Dan Williams 2021-06-09  36  				  &lnkcap) != PCIBIOS_SUCCESSFUL)
3b94ce7b7bc1b4 Dan Williams 2021-06-09  37  		return 0;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  38  
3b94ce7b7bc1b4 Dan Williams 2021-06-09  39  	/* TODO walk DVSEC to find component register base */
3b94ce7b7bc1b4 Dan Williams 2021-06-09  40  	port_num = FIELD_GET(PCI_EXP_LNKCAP_PN, lnkcap);
3b94ce7b7bc1b4 Dan Williams 2021-06-09  41  	rc = cxl_add_dport(port, &pdev->dev, port_num, CXL_RESOURCE_NONE);
3b94ce7b7bc1b4 Dan Williams 2021-06-09  42  	if (rc) {
3b94ce7b7bc1b4 Dan Williams 2021-06-09  43  		ctx->error = rc;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  44  		return rc;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  45  	}
3b94ce7b7bc1b4 Dan Williams 2021-06-09  46  	ctx->count++;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  47  
3b94ce7b7bc1b4 Dan Williams 2021-06-09  48  	dev_dbg(dev, "add dport%d: %s\n", port_num, dev_name(&pdev->dev));
3b94ce7b7bc1b4 Dan Williams 2021-06-09  49  
3b94ce7b7bc1b4 Dan Williams 2021-06-09  50  	return 0;
3b94ce7b7bc1b4 Dan Williams 2021-06-09  51  }
3b94ce7b7bc1b4 Dan Williams 2021-06-09  52  

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

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

only message in thread, other threads:[~2022-01-25 11:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 11:34 drivers/cxl/acpi.c:25:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores] 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.