From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH] PCI/portdrv: Do not setup up IRQs if there are no users
Date: Sun, 22 Aug 2021 15:35:33 +0800 [thread overview]
Message-ID: <202108221525.NT2Kap5Q-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 18682 bytes --]
CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
In-Reply-To: <43e1591d-51ed-39fa-3bc5-c11777f27b62@siemens.com>
References: <43e1591d-51ed-39fa-3bc5-c11777f27b62@siemens.com>
TO: Jan Kiszka <jan.kiszka@siemens.com>
TO: "linux-pci(a)vger.kernel.org" <linux-pci@vger.kernel.org>
TO: Bjorn Helgaas <helgaas@kernel.org>
CC: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Hi Jan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on pci/next]
[also build test WARNING on v5.14-rc6 next-20210820]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jan-Kiszka/PCI-portdrv-Do-not-setup-up-IRQs-if-there-are-no-users/20210820-215311
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: arm-randconfig-c002-20210822 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 9e9d70591e72fc6762b4b9a226b68ed1307419bf)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/30b9aea30a820b153bb866daf79d1738628934d8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jan-Kiszka/PCI-portdrv-Do-not-setup-up-IRQs-if-there-are-no-users/20210820-215311
git checkout 30b9aea30a820b153bb866daf79d1738628934d8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 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/workqueue.h:272:2: note: expanded from macro 'INIT_DELAYED_WORK'
__INIT_DELAYED_WORK(_work, _func, 0)
^
include/linux/workqueue.h:258:3: note: expanded from macro '__INIT_DELAYED_WORK'
__init_timer(&(_work)->timer, \
^
include/linux/timer.h:113:2: note: expanded from macro '__init_timer'
do { \
^
drivers/media/cec/core/cec-adap.c:897:2: note: Loop condition is false. Exiting loop
INIT_DELAYED_WORK(&data->work, cec_wait_timeout);
^
include/linux/workqueue.h:272:2: note: expanded from macro 'INIT_DELAYED_WORK'
__INIT_DELAYED_WORK(_work, _func, 0)
^
include/linux/workqueue.h:256:2: note: expanded from macro '__INIT_DELAYED_WORK'
do { \
^
drivers/media/cec/core/cec-adap.c:899:6: note: Assuming 'fh' is null
if (fh)
^~
drivers/media/cec/core/cec-adap.c:899:2: note: Taking false branch
if (fh)
^
drivers/media/cec/core/cec-adap.c:904:6: note: Assuming field 'transmitting' is non-null
if (!adap->transmitting)
^~~~~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:904:2: note: Taking false branch
if (!adap->transmitting)
^
drivers/media/cec/core/cec-adap.c:908:6: note: Assuming 'block' is true
if (!block)
^~~~~~
drivers/media/cec/core/cec-adap.c:908:2: note: Taking false branch
if (!block)
^
drivers/media/cec/core/cec-adap.c:916:6: note: Assuming field 'completed' is false
if (!data->completed)
^~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:916:2: note: Taking true branch
if (!data->completed)
^
drivers/media/cec/core/cec-adap.c:921:6: note: Assuming field 'completed' is false
if (!data->completed)
^~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:921:2: note: Taking true branch
if (!data->completed)
^
drivers/media/cec/core/cec-adap.c:922:3: note: Calling 'cec_data_cancel'
cec_data_cancel(data, CEC_TX_STATUS_ABORTED);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:378:6: note: Assuming 'data' is equal to field 'transmitting'
if (data->adap->transmitting == data) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:378:2: note: Taking true branch
if (data->adap->transmitting == data) {
^
drivers/media/cec/core/cec-adap.c:387:6: note: Assuming the condition is true
if (data->msg.tx_status & CEC_TX_STATUS_OK) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:387:2: note: Taking true branch
if (data->msg.tx_status & CEC_TX_STATUS_OK) {
^
drivers/media/cec/core/cec-adap.c:401:2: note: Calling 'cec_data_completed'
cec_data_completed(data);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:344:6: note: Assuming field 'fh' is null
if (data->fh)
^~~~~~~~
drivers/media/cec/core/cec-adap.c:344:2: note: Taking false branch
if (data->fh)
^
drivers/media/cec/core/cec-adap.c:347:6: note: Assuming field 'blocking' is false
if (data->blocking) {
^~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:347:2: note: Taking false branch
if (data->blocking) {
^
drivers/media/cec/core/cec-adap.c:359:13: note: Field 'fh' is null
if (data->fh)
^
drivers/media/cec/core/cec-adap.c:359:3: note: Taking false branch
if (data->fh)
^
drivers/media/cec/core/cec-adap.c:361:3: note: Memory is released
kfree(data);
^~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:401:2: note: Returning; memory was released via 1st parameter
cec_data_completed(data);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:922:3: note: Returning; memory was released via 1st parameter
cec_data_cancel(data, CEC_TX_STATUS_ABORTED);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:925:9: note: Use of memory after it is freed
*msg = data->msg;
^~~~~~~~~
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.
>> drivers/pci/pcie/portdrv_core.c:364:8: warning: 3rd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
if (!pcie_device_init(dev, service, irqs[i]))
^ ~~~~~~~
drivers/pci/pcie/portdrv_core.c:320:6: note: Assuming 'status' is 0
if (status)
^~~~~~
drivers/pci/pcie/portdrv_core.c:320:2: note: Taking false branch
if (status)
^
drivers/pci/pcie/portdrv_core.c:324:17: note: Calling 'get_port_device_capability'
capabilities = get_port_device_capability(dev);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:211:6: note: Assuming field 'is_hotplug_bridge' is not equal to 0
if (dev->is_hotplug_bridge &&
^~~~~~~~~~~~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:211:6: note: Left side of '&&' is true
drivers/pci/pcie/portdrv_core.c:212:7: note: Assuming 'pcie_ports_native' is true
(pcie_ports_native || host->native_pcie_hotplug)) {
^~~~~~~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:212:25: note: Left side of '||' is true
(pcie_ports_native || host->native_pcie_hotplug)) {
^
drivers/pci/pcie/portdrv_core.c:224:6: note: Assuming field 'aer_cap' is 0
if (dev->aer_cap && pci_aer_available() &&
^~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:224:19: note: Left side of '&&' is false
if (dev->aer_cap && pci_aer_available() &&
^
drivers/pci/pcie/portdrv_core.c:237:7: note: Assuming the condition is true
if ((pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:237:52: note: Left side of '||' is true
if ((pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT ||
^
drivers/pci/pcie/portdrv_core.c:239:7: note: Assuming 'pcie_ports_native' is false
(pcie_ports_native || host->native_pme)) {
^~~~~~~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:239:7: note: Left side of '||' is false
drivers/pci/pcie/portdrv_core.c:239:28: note: Assuming field 'native_pme' is 0
(pcie_ports_native || host->native_pme)) {
^~~~~~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:237:2: note: Taking false branch
if ((pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT ||
^
drivers/pci/pcie/portdrv_core.c:254:6: note: Assuming the condition is false
if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:254:55: note: Left side of '&&' is false
if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
^
drivers/pci/pcie/portdrv_core.c:259:6: note: Assuming the condition is true
if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:259:52: note: Left side of '||' is true
if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM ||
^
drivers/pci/pcie/portdrv_core.c:263:2: note: Returning the value 20 (loaded from 'services'), which participates in a condition later
return services;
^~~~~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:324:17: note: Returning from 'get_port_device_capability'
capabilities = get_port_device_capability(dev);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:325:7: note: 'capabilities' is 20
if (!capabilities)
^~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:325:2: note: Taking false branch
if (!capabilities)
^
drivers/pci/pcie/portdrv_core.c:331:2: note: Taking true branch
if (IS_ENABLED(CONFIG_PCIE_PME))
^
drivers/pci/pcie/portdrv_core.c:333:2: note: Taking true branch
if (IS_ENABLED(CONFIG_PCIEAER))
^
drivers/pci/pcie/portdrv_core.c:335:2: note: Taking false branch
if (IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE))
^
drivers/pci/pcie/portdrv_core.c:337:2: note: Taking false branch
if (IS_ENABLED(CONFIG_PCIE_DPC))
^
drivers/pci/pcie/portdrv_core.c:341:6: note: 'irq_services' is 0
if (irq_services) {
^~~~~~~~~~~~
drivers/pci/pcie/portdrv_core.c:341:2: note: Taking false branch
if (irq_services) {
^
drivers/pci/pcie/portdrv_core.c:360:2: note: Loop condition is true. Entering loop body
for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) {
^
drivers/pci/pcie/portdrv_core.c:362:3: note: Taking true branch
if (!(capabilities & service))
^
drivers/pci/pcie/portdrv_core.c:363:4: note: Execution continues on line 360
continue;
^
drivers/pci/pcie/portdrv_core.c:360:2: note: Loop condition is true. Entering loop body
for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) {
^
drivers/pci/pcie/portdrv_core.c:362:3: note: Taking true branch
if (!(capabilities & service))
^
vim +364 drivers/pci/pcie/portdrv_core.c
8f3acca9acec15 Bjorn Helgaas 2013-12-19 305
facf6d1627a33b Rafael J. Wysocki 2009-01-01 306 /**
facf6d1627a33b Rafael J. Wysocki 2009-01-01 307 * pcie_port_device_register - register PCI Express port
facf6d1627a33b Rafael J. Wysocki 2009-01-01 308 * @dev: PCI Express port to register
facf6d1627a33b Rafael J. Wysocki 2009-01-01 309 *
facf6d1627a33b Rafael J. Wysocki 2009-01-01 310 * Allocate the port extension structure and register services associated with
facf6d1627a33b Rafael J. Wysocki 2009-01-01 311 * the port.
facf6d1627a33b Rafael J. Wysocki 2009-01-01 312 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 313 int pcie_port_device_register(struct pci_dev *dev)
^1da177e4c3f41 Linus Torvalds 2005-04-16 314 {
30b9aea30a820b Jan Kiszka 2021-08-20 315 int status, capabilities, irq_services, i, nr_service;
dc5351784eb36f Kenji Kaneshige 2009-11-25 316 int irqs[PCIE_PORT_DEVICE_MAXSERVICES];
^1da177e4c3f41 Linus Torvalds 2005-04-16 317
1ce5e83063bf38 Kenji Kaneshige 2009-11-25 318 /* Enable PCI Express port device */
1ce5e83063bf38 Kenji Kaneshige 2009-11-25 319 status = pci_enable_device(dev);
1ce5e83063bf38 Kenji Kaneshige 2009-11-25 320 if (status)
694f88ef7ada0d Kenji Kaneshige 2009-11-25 321 return status;
fe31e69740eddc Rafael J. Wysocki 2010-12-19 322
fe31e69740eddc Rafael J. Wysocki 2010-12-19 323 /* Get and check PCI Express port services */
fe31e69740eddc Rafael J. Wysocki 2010-12-19 324 capabilities = get_port_device_capability(dev);
eca67315e0e0d5 Naga Chumbalkar 2011-03-21 325 if (!capabilities)
fe31e69740eddc Rafael J. Wysocki 2010-12-19 326 return 0;
fe31e69740eddc Rafael J. Wysocki 2010-12-19 327
1ce5e83063bf38 Kenji Kaneshige 2009-11-25 328 pci_set_master(dev);
30b9aea30a820b Jan Kiszka 2021-08-20 329
30b9aea30a820b Jan Kiszka 2021-08-20 330 irq_services = 0;
30b9aea30a820b Jan Kiszka 2021-08-20 331 if (IS_ENABLED(CONFIG_PCIE_PME))
30b9aea30a820b Jan Kiszka 2021-08-20 332 irq_services |= PCIE_PORT_SERVICE_PME;
30b9aea30a820b Jan Kiszka 2021-08-20 333 if (IS_ENABLED(CONFIG_PCIEAER))
30b9aea30a820b Jan Kiszka 2021-08-20 334 irq_services |= PCIE_PORT_SERVICE_AER;
30b9aea30a820b Jan Kiszka 2021-08-20 335 if (IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE))
30b9aea30a820b Jan Kiszka 2021-08-20 336 irq_services |= PCIE_PORT_SERVICE_HP;
30b9aea30a820b Jan Kiszka 2021-08-20 337 if (IS_ENABLED(CONFIG_PCIE_DPC))
30b9aea30a820b Jan Kiszka 2021-08-20 338 irq_services |= PCIE_PORT_SERVICE_DPC;
30b9aea30a820b Jan Kiszka 2021-08-20 339 irq_services &= capabilities;
30b9aea30a820b Jan Kiszka 2021-08-20 340
30b9aea30a820b Jan Kiszka 2021-08-20 341 if (irq_services) {
f118c0c3cff4fe Rafael J. Wysocki 2009-01-13 342 /*
dc5351784eb36f Kenji Kaneshige 2009-11-25 343 * Initialize service irqs. Don't use service devices that
dc5351784eb36f Kenji Kaneshige 2009-11-25 344 * require interrupts if there is no way to generate them.
30b9aea30a820b Jan Kiszka 2021-08-20 345 * However, some drivers may have a polling mode (e.g.
30b9aea30a820b Jan Kiszka 2021-08-20 346 * pciehp_poll_mode) that can be used in the absence of irqs.
30b9aea30a820b Jan Kiszka 2021-08-20 347 * Allow them to determine if that is to be used.
f118c0c3cff4fe Rafael J. Wysocki 2009-01-13 348 */
30b9aea30a820b Jan Kiszka 2021-08-20 349 status = pcie_init_service_irqs(dev, irqs, irq_services);
dc5351784eb36f Kenji Kaneshige 2009-11-25 350 if (status) {
30b9aea30a820b Jan Kiszka 2021-08-20 351 irq_services &= PCIE_PORT_SERVICE_HP;
30b9aea30a820b Jan Kiszka 2021-08-20 352 if (!irq_services)
1ce5e83063bf38 Kenji Kaneshige 2009-11-25 353 goto error_disable;
f118c0c3cff4fe Rafael J. Wysocki 2009-01-13 354 }
30b9aea30a820b Jan Kiszka 2021-08-20 355 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 356
^1da177e4c3f41 Linus Torvalds 2005-04-16 357 /* Allocate child services if any */
40717c39b1e6c0 Kenji Kaneshige 2009-11-25 358 status = -ENODEV;
40717c39b1e6c0 Kenji Kaneshige 2009-11-25 359 nr_service = 0;
40717c39b1e6c0 Kenji Kaneshige 2009-11-25 360 for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) {
90e9cd50f7feed Rafael J. Wysocki 2009-01-13 361 int service = 1 << i;
90e9cd50f7feed Rafael J. Wysocki 2009-01-13 362 if (!(capabilities & service))
90e9cd50f7feed Rafael J. Wysocki 2009-01-13 363 continue;
40717c39b1e6c0 Kenji Kaneshige 2009-11-25 @364 if (!pcie_device_init(dev, service, irqs[i]))
40717c39b1e6c0 Kenji Kaneshige 2009-11-25 365 nr_service++;
f118c0c3cff4fe Rafael J. Wysocki 2009-01-13 366 }
40717c39b1e6c0 Kenji Kaneshige 2009-11-25 367 if (!nr_service)
fbb5de70bbe13e Kenji Kaneshige 2009-11-25 368 goto error_cleanup_irqs;
40717c39b1e6c0 Kenji Kaneshige 2009-11-25 369
^1da177e4c3f41 Linus Torvalds 2005-04-16 370 return 0;
f118c0c3cff4fe Rafael J. Wysocki 2009-01-13 371
fbb5de70bbe13e Kenji Kaneshige 2009-11-25 372 error_cleanup_irqs:
3674cc49da9a8f Christoph Hellwig 2017-02-01 373 pci_free_irq_vectors(dev);
1ce5e83063bf38 Kenji Kaneshige 2009-11-25 374 error_disable:
1ce5e83063bf38 Kenji Kaneshige 2009-11-25 375 pci_disable_device(dev);
f118c0c3cff4fe Rafael J. Wysocki 2009-01-13 376 return status;
^1da177e4c3f41 Linus Torvalds 2005-04-16 377 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 378
---
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: 37320 bytes --]
next reply other threads:[~2021-08-22 7:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-22 7:35 kernel test robot [this message]
2021-08-29 8:29 ` [PATCH] PCI/portdrv: Do not setup up IRQs if there are no users kernel test robot
2021-08-29 8:29 ` kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2021-08-20 13:52 Jan Kiszka
2021-08-20 14:45 ` Lukas Wunner
2021-08-20 14:47 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202108221525.NT2Kap5Q-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.