From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com
Subject: [mnyman-xhci:for-usb-next 8/11] drivers/usb/host/xhci-hub.c:606:2: warning: Value stored to 'portsc' is never read [clang-analyzer-deadcode.DeadStores]
Date: Mon, 6 Feb 2023 17:11:29 +0800 [thread overview]
Message-ID: <202302061750.9zmcAVWS-lkp@intel.com> (raw)
::::::
:::::: Manual check reason: "low confidence static check warning: drivers/usb/host/xhci-hub.c:606:2: warning: Value stored to 'portsc' is never read [clang-analyzer-deadcode.DeadStores]"
::::::
BCC: lkp@intel.com
CC: llvm@lists.linux.dev
CC: oe-kbuild-all@lists.linux.dev
TO: Mathias Nyman <mathias.nyman@linux.intel.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git for-usb-next
head: a735337dbb209d81aab4d29015fe9f61140ee3f1
commit: 6469bdaad3f2ed0e0dcb120edc1b2e949fe40bc1 [8/11] xhci: Pass port structure as parameter to xhci_disable_port().
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: riscv-randconfig-c006-20230202 (https://download.01.org/0day-ci/archive/20230206/202302061750.9zmcAVWS-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 4196ca3278f78c6e19246e54ab0ecb364e37d66a)
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/mnyman/xhci.git/commit/?id=6469bdaad3f2ed0e0dcb120edc1b2e949fe40bc1
git remote add mnyman-xhci https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git
git fetch --no-tags mnyman-xhci for-usb-next
git checkout 6469bdaad3f2ed0e0dcb120edc1b2e949fe40bc1
# save the config file
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
clang_analyzer warnings: (new ones prefixed by >>)
^~~~~~~~~~~~
include/asm-generic/bitops/generic-non-atomic.h:128:16: note: Array access (from variable 'addr') results in a null pointer dereference
return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
^~~~
Suppressed 8 warnings (8 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.
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.
include/asm-generic/bitops/generic-non-atomic.h:128:16: warning: Array access (from variable 'addr') results in a null pointer dereference [clang-analyzer-core.NullDereference]
return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
^
drivers/input/mousedev.c:351:2: note: Control jumps to 'case 3:' at line 353
switch (type) {
^
drivers/input/mousedev.c:355:7: note: Left side of '&&' is true
if (test_bit(BTN_TRIGGER, handle->dev->keybit))
^
include/linux/bitops.h:61:29: note: expanded from macro 'test_bit'
#define test_bit(nr, addr) bitop(_test_bit, nr, addr)
^
include/linux/bitops.h:49:4: note: expanded from macro 'bitop'
((__builtin_constant_p(nr) && \
^
drivers/input/mousedev.c:355:7: note: Assuming field 'keybit' is equal to 0
if (test_bit(BTN_TRIGGER, handle->dev->keybit))
^
include/linux/bitops.h:61:29: note: expanded from macro 'test_bit'
#define test_bit(nr, addr) bitop(_test_bit, nr, addr)
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bitops.h:50:25: note: expanded from macro 'bitop'
__builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/input/mousedev.c:355:7: note: Left side of '&&' is false
if (test_bit(BTN_TRIGGER, handle->dev->keybit))
^
include/linux/bitops.h:61:29: note: expanded from macro 'test_bit'
#define test_bit(nr, addr) bitop(_test_bit, nr, addr)
^
include/linux/bitops.h:50:63: note: expanded from macro 'bitop'
__builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
^
drivers/input/mousedev.c:355:29: note: Passing null pointer value via 2nd parameter 'addr'
if (test_bit(BTN_TRIGGER, handle->dev->keybit))
^
include/linux/bitops.h:61:50: note: expanded from macro 'test_bit'
#define test_bit(nr, addr) bitop(_test_bit, nr, addr)
^~~~
include/linux/bitops.h:53:32: note: expanded from macro 'bitop'
const##op(nr, addr) : op(nr, addr))
^~~~
drivers/input/mousedev.c:355:7: note: Calling 'generic_test_bit'
if (test_bit(BTN_TRIGGER, handle->dev->keybit))
^
include/linux/bitops.h:61:35: note: expanded from macro 'test_bit'
#define test_bit(nr, addr) bitop(_test_bit, nr, addr)
~~~~~~^~~~~~~~~~~~~~~~~~~~
include/asm-generic/bitops/non-instrumented-non-atomic.h:14:20: note: expanded from macro '_test_bit'
#define _test_bit arch_test_bit
^
include/asm-generic/bitops/non-atomic.h:15:23: note: expanded from macro 'arch_test_bit'
#define arch_test_bit generic_test_bit
^
include/linux/bitops.h:53:25: note: expanded from macro 'bitop'
const##op(nr, addr) : op(nr, addr))
^~~~~~~~~~~~
include/asm-generic/bitops/generic-non-atomic.h:128:16: note: Array access (from variable 'addr') results in a null pointer dereference
return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
^~~~
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.
34 warnings generated.
drivers/usb/host/xhci-hub.c:71:13: warning: The left operand of '>=' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
if (bcdUSB >= 0x0310) {
~~~~~~ ^
drivers/usb/host/xhci-hub.c:42:2: note: 'bcdUSB' declared without an initial value
u16 bcdUSB;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:60:14: note: Assuming 'i' is >= field 'num_port_caps'
for (i = 0; i < xhci->num_port_caps; i++) {
^~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:60:2: note: Loop condition is false. Execution continues on line 71
for (i = 0; i < xhci->num_port_caps; i++) {
^
drivers/usb/host/xhci-hub.c:71:13: note: The left operand of '>=' is a garbage value
if (bcdUSB >= 0x0310) {
~~~~~~ ^
drivers/usb/host/xhci-hub.c:497:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = 0;
^ ~
drivers/usb/host/xhci-hub.c:497:2: note: Value stored to 'ret' is never read
ret = 0;
^ ~
>> drivers/usb/host/xhci-hub.c:606:2: warning: Value stored to 'portsc' is never read [clang-analyzer-deadcode.DeadStores]
portsc = readl(port->addr);
^
drivers/usb/host/xhci-hub.c:606:2: note: Value stored to 'portsc' is never read
drivers/usb/host/xhci-hub.c:620:3: warning: Value stored to 'port_change_bit' is never read [clang-analyzer-deadcode.DeadStores]
port_change_bit = "reset";
^ ~~~~~~~
drivers/usb/host/xhci-hub.c:620:3: note: Value stored to 'port_change_bit' is never read
port_change_bit = "reset";
^ ~~~~~~~
drivers/usb/host/xhci-hub.c:624:3: warning: Value stored to 'port_change_bit' is never read [clang-analyzer-deadcode.DeadStores]
port_change_bit = "warm(BH) reset";
^ ~~~~~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:624:3: note: Value stored to 'port_change_bit' is never read
port_change_bit = "warm(BH) reset";
^ ~~~~~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:628:3: warning: Value stored to 'port_change_bit' is never read [clang-analyzer-deadcode.DeadStores]
port_change_bit = "connect";
^ ~~~~~~~~~
drivers/usb/host/xhci-hub.c:628:3: note: Value stored to 'port_change_bit' is never read
port_change_bit = "connect";
^ ~~~~~~~~~
drivers/usb/host/xhci-hub.c:632:3: warning: Value stored to 'port_change_bit' is never read [clang-analyzer-deadcode.DeadStores]
port_change_bit = "over-current";
^ ~~~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:632:3: note: Value stored to 'port_change_bit' is never read
port_change_bit = "over-current";
^ ~~~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:636:3: warning: Value stored to 'port_change_bit' is never read [clang-analyzer-deadcode.DeadStores]
port_change_bit = "enable/disable";
^ ~~~~~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:636:3: note: Value stored to 'port_change_bit' is never read
port_change_bit = "enable/disable";
^ ~~~~~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:640:3: warning: Value stored to 'port_change_bit' is never read [clang-analyzer-deadcode.DeadStores]
port_change_bit = "suspend/resume";
^ ~~~~~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:640:3: note: Value stored to 'port_change_bit' is never read
port_change_bit = "suspend/resume";
^ ~~~~~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:644:3: warning: Value stored to 'port_change_bit' is never read [clang-analyzer-deadcode.DeadStores]
port_change_bit = "link state";
^ ~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:644:3: note: Value stored to 'port_change_bit' is never read
port_change_bit = "link state";
^ ~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:648:3: warning: Value stored to 'port_change_bit' is never read [clang-analyzer-deadcode.DeadStores]
port_change_bit = "config error";
^ ~~~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:648:3: note: Value stored to 'port_change_bit' is never read
port_change_bit = "config error";
^ ~~~~~~~~~~~~~~
drivers/usb/host/xhci-hub.c:656:2: warning: Value stored to 'port_status' is never read [clang-analyzer-deadcode.DeadStores]
port_status = readl(addr);
^
drivers/usb/host/xhci-hub.c:656:2: note: Value stored to 'port_status' is never read
drivers/usb/host/xhci-hub.c:1354:4: warning: Value stored to 'temp' is never read [clang-analyzer-deadcode.DeadStores]
temp = readl(port->addr);
^
drivers/usb/host/xhci-hub.c:1354:4: note: Value stored to 'temp' is never read
drivers/usb/host/xhci-hub.c:1372:5: warning: Value stored to 'temp' is never read [clang-analyzer-deadcode.DeadStores]
temp = readl(port->addr);
^
drivers/usb/host/xhci-hub.c:1372:5: note: Value stored to 'temp' is never read
drivers/usb/host/xhci-hub.c:1381:5: warning: Value stored to 'temp' is never read [clang-analyzer-deadcode.DeadStores]
temp = readl(port->addr);
^
drivers/usb/host/xhci-hub.c:1381:5: note: Value stored to 'temp' is never read
drivers/usb/host/xhci-hub.c:1414:5: warning: Value stored to 'temp' is never read [clang-analyzer-deadcode.DeadStores]
temp = readl(port->addr);
^
drivers/usb/host/xhci-hub.c:1414:5: note: Value stored to 'temp' is never read
drivers/usb/host/xhci-hub.c:1462:5: warning: Value stored to 'temp' is never read [clang-analyzer-deadcode.DeadStores]
temp = readl(port->addr);
^
drivers/usb/host/xhci-hub.c:1462:5: note: Value stored to 'temp' is never read
drivers/usb/host/xhci-hub.c:1487:5: warning: Value stored to 'temp' is never read [clang-analyzer-deadcode.DeadStores]
temp = readl(port->addr);
^
drivers/usb/host/xhci-hub.c:1487:5: note: Value stored to 'temp' is never read
drivers/usb/host/xhci-hub.c:1504:4: warning: Value stored to 'temp' is never read [clang-analyzer-deadcode.DeadStores]
temp = readl(port->addr);
^
drivers/usb/host/xhci-hub.c:1504:4: note: Value stored to 'temp' is never read
drivers/usb/host/xhci-hub.c:1510:4: warning: Value stored to 'temp' is never read [clang-analyzer-deadcode.DeadStores]
temp = readl(port->addr);
^
drivers/usb/host/xhci-hub.c:1510:4: note: Value stored to 'temp' is never read
drivers/usb/host/xhci-hub.c:1517:4: warning: Value stored to 'temp' is never read [clang-analyzer-deadcode.DeadStores]
temp = readl(port->addr);
^
drivers/usb/host/xhci-hub.c:1517:4: note: Value stored to 'temp' is never read
drivers/usb/host/xhci-hub.c:1549:3: warning: Value stored to 'temp' is never read [clang-analyzer-deadcode.DeadStores]
temp = readl(port->addr);
^
drivers/usb/host/xhci-hub.c:1549:3: note: Value stored to 'temp' is never read
Suppressed 12 warnings (12 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.
vim +/portsc +606 drivers/usb/host/xhci-hub.c
be88fe4f4dda93 Andiry Xu 2010-10-14 580
6469bdaad3f2ed Mathias Nyman 2022-12-12 581 static void xhci_disable_port(struct xhci_hcd *xhci, struct xhci_port *port)
6219c047d3fe18 Sarah Sharp 2009-12-09 582 {
6469bdaad3f2ed Mathias Nyman 2022-12-12 583 struct usb_hcd *hcd;
6469bdaad3f2ed Mathias Nyman 2022-12-12 584 u32 portsc;
6469bdaad3f2ed Mathias Nyman 2022-12-12 585
6469bdaad3f2ed Mathias Nyman 2022-12-12 586 hcd = port->rhub->hcd;
6469bdaad3f2ed Mathias Nyman 2022-12-12 587
6dd0a3a7e0793d Sarah Sharp 2010-11-16 588 /* Don't allow the USB core to disable SuperSpeed ports. */
b50107bb83d027 Mathias Nyman 2015-10-01 589 if (hcd->speed >= HCD_USB3) {
6469bdaad3f2ed Mathias Nyman 2022-12-12 590 xhci_dbg(xhci, "Ignoring request to disable SuperSpeed port.\n");
6dd0a3a7e0793d Sarah Sharp 2010-11-16 591 return;
6dd0a3a7e0793d Sarah Sharp 2010-11-16 592 }
6dd0a3a7e0793d Sarah Sharp 2010-11-16 593
41135de1e7fd14 Felipe Balbi 2017-01-23 594 if (xhci->quirks & XHCI_BROKEN_PORT_PED) {
41135de1e7fd14 Felipe Balbi 2017-01-23 595 xhci_dbg(xhci,
41135de1e7fd14 Felipe Balbi 2017-01-23 596 "Broken Port Enabled/Disabled, ignoring port disable request.\n");
41135de1e7fd14 Felipe Balbi 2017-01-23 597 return;
41135de1e7fd14 Felipe Balbi 2017-01-23 598 }
41135de1e7fd14 Felipe Balbi 2017-01-23 599
6469bdaad3f2ed Mathias Nyman 2022-12-12 600 portsc = readl(port->addr);
6469bdaad3f2ed Mathias Nyman 2022-12-12 601 portsc = xhci_port_state_to_neutral(portsc);
6469bdaad3f2ed Mathias Nyman 2022-12-12 602
6219c047d3fe18 Sarah Sharp 2009-12-09 603 /* Write 1 to disable the port */
6469bdaad3f2ed Mathias Nyman 2022-12-12 604 writel(portsc | PORT_PE, port->addr);
6469bdaad3f2ed Mathias Nyman 2022-12-12 605
6469bdaad3f2ed Mathias Nyman 2022-12-12 @606 portsc = readl(port->addr);
d70d5a846671c3 Mathias Nyman 2019-04-26 607 xhci_dbg(xhci, "disable port %d-%d, portsc: 0x%x\n",
6469bdaad3f2ed Mathias Nyman 2022-12-12 608 hcd->self.busnum, port->hcd_portnum + 1, portsc);
6219c047d3fe18 Sarah Sharp 2009-12-09 609 }
6219c047d3fe18 Sarah Sharp 2009-12-09 610
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
reply other threads:[~2023-02-06 9:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202302061750.9zmcAVWS-lkp@intel.com \
--to=lkp@intel.com \
--cc=oe-kbuild@lists.linux.dev \
/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.