* drivers/ata/pata_pdc2027x.c:521:2: warning: Value stored to 'pll_ctl' is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-01-25 15:14 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-01-25 15:14 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 23207 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Hannes Reinecke <hare@suse.com>
CC: Damien Le Moal <damien.lemoal@opensource.wdc.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a08b41ab9e2e468647f78eb17c28e29b93006394
commit: b5a5fc8b0f8175e4b3aaf182c1b23de4ccdd3347 ata: pata_pdc2027x: Replace PDPRINTK() with standard ata logging
date: 3 weeks ago
:::::: branch date: 9 hours ago
:::::: commit date: 3 weeks ago
config: x86_64-randconfig-c007-20220124 (https://download.01.org/0day-ci/archive/20220125/202201252302.RWrXf0BG-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=b5a5fc8b0f8175e4b3aaf182c1b23de4ccdd3347
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout b5a5fc8b0f8175e4b3aaf182c1b23de4ccdd3347
# 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 >>)
1 warning generated.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
drivers/acpi/pci_link.c:88:14: warning: Value stored to 'handle' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
acpi_handle handle = link->device->handle;
^~~~~~ ~~~~~~~~~~~~~~~~~~~~
drivers/acpi/pci_link.c:88:14: note: Value stored to 'handle' during its initialization is never read
acpi_handle handle = link->device->handle;
^~~~~~ ~~~~~~~~~~~~~~~~~~~~
drivers/acpi/pci_link.c:721: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(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME);
^~~~~~
drivers/acpi/pci_link.c:721: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(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME);
^~~~~~
drivers/acpi/pci_link.c:722: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(acpi_device_class(device), ACPI_PCI_LINK_CLASS);
^~~~~~
drivers/acpi/pci_link.c:722: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(acpi_device_class(device), ACPI_PCI_LINK_CLASS);
^~~~~~
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
drivers/acpi/pci_irq.c:131:4: 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(prt->source, quirk->actual_source);
^~~~~~
drivers/acpi/pci_irq.c:131:4: 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(prt->source, quirk->actual_source);
^~~~~~
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
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.
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.
7 warnings generated.
>> drivers/ata/pata_pdc2027x.c:521:2: warning: Value stored to 'pll_ctl' is never read [clang-analyzer-deadcode.DeadStores]
pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/ata/pata_pdc2027x.c:521:2: note: Value stored to 'pll_ctl' is never read
pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/ata/pata_pdc2027x.c:570:2: warning: Value stored to 'pll_ctl' is never read [clang-analyzer-deadcode.DeadStores]
pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/ata/pata_pdc2027x.c:570:2: note: Value stored to 'pll_ctl' is never read
pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
1 warning generated.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
drivers/video/fbdev/riva/rivafb-i2c.c:94: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(chan->adapter.name, name);
^~~~~~
drivers/video/fbdev/riva/rivafb-i2c.c:94: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(chan->adapter.name, name);
^~~~~~
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
drivers/video/fbdev/nvidia/nvidia.c:124:4: warning: Value stored to 'tmp' is never read [clang-analyzer-deadcode.DeadStores]
tmp = 0;
^ ~
drivers/video/fbdev/nvidia/nvidia.c:124:4: note: Value stored to 'tmp' is never read
tmp = 0;
^ ~
Suppressed 1 warnings (1 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/video/fbdev/nvidia/nv_hw.c:261:2: warning: Value stored to 'clwm' is never read [clang-analyzer-deadcode.DeadStores]
clwm = 0;
^ ~
drivers/video/fbdev/nvidia/nv_hw.c:261:2: note: Value stored to 'clwm' is never read
clwm = 0;
^ ~
drivers/video/fbdev/nvidia/nv_hw.c:284:2: warning: Value stored to 'pclks' is never read [clang-analyzer-deadcode.DeadStores]
pclks += 0;
^ ~
drivers/video/fbdev/nvidia/nv_hw.c:284:2: note: Value stored to 'pclks' is never read
pclks += 0;
^ ~
drivers/video/fbdev/nvidia/nv_hw.c:439:2: warning: Value stored to 'clwm' is never read [clang-analyzer-deadcode.DeadStores]
clwm = 0;
^ ~
drivers/video/fbdev/nvidia/nv_hw.c:439:2: note: Value stored to 'clwm' is never read
clwm = 0;
^ ~
Suppressed 2 warnings (1 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.
1 warning generated.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 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.
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
drivers/hwmon/lm75.h:30:29: warning: The result of the left shift is undefined because the left operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
return (u16)((ntemp / 500) << 7);
^
drivers/hwmon/ad7418.c:166:6: note: Assuming 'ret' is >= 0
if (ret < 0)
^~~~~~~
drivers/hwmon/ad7418.c:166:2: note: Taking false branch
if (ret < 0)
^
drivers/hwmon/ad7418.c:170:28: note: Calling 'LM75_TEMP_TO_REG'
data->temp[attr->index] = LM75_TEMP_TO_REG(temp);
^~~~~~~~~~~~~~~~~~~~~~
drivers/hwmon/lm75.h:27:14: note: Assuming '__UNIQUE_ID___x298' is <= '__UNIQUE_ID___y299'
int ntemp = clamp_val(temp, LM75_TEMP_MIN, LM75_TEMP_MAX);
vim +/pll_ctl +521 drivers/ata/pata_pdc2027x.c
669a5db411d85a Jeff Garzik 2006-08-29 492
669a5db411d85a Jeff Garzik 2006-08-29 493 /**
1906cf27fcc070 Lee Jones 2021-02-01 494 * pdc_adjust_pll - Adjust the PLL input clock in Hz.
669a5db411d85a Jeff Garzik 2006-08-29 495 *
5d728824efeda6 Tejun Heo 2007-04-17 496 * @host: target ATA host
669a5db411d85a Jeff Garzik 2006-08-29 497 * @pll_clock: The input of PLL in HZ
1906cf27fcc070 Lee Jones 2021-02-01 498 * @board_idx: board identifier
669a5db411d85a Jeff Garzik 2006-08-29 499 */
5d728824efeda6 Tejun Heo 2007-04-17 500 static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int board_idx)
669a5db411d85a Jeff Garzik 2006-08-29 501 {
5d728824efeda6 Tejun Heo 2007-04-17 502 void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR];
669a5db411d85a Jeff Garzik 2006-08-29 503 u16 pll_ctl;
669a5db411d85a Jeff Garzik 2006-08-29 504 long pll_clock_khz = pll_clock / 1000;
669a5db411d85a Jeff Garzik 2006-08-29 505 long pout_required = board_idx? PDC_133_MHZ:PDC_100_MHZ;
669a5db411d85a Jeff Garzik 2006-08-29 506 long ratio = pout_required / pll_clock_khz;
669a5db411d85a Jeff Garzik 2006-08-29 507 int F, R;
669a5db411d85a Jeff Garzik 2006-08-29 508
669a5db411d85a Jeff Garzik 2006-08-29 509 /* Sanity check */
669a5db411d85a Jeff Garzik 2006-08-29 510 if (unlikely(pll_clock_khz < 5000L || pll_clock_khz > 70000L)) {
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 511 dev_err(host->dev, "Invalid PLL input clock %ldkHz, give up!\n",
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 512 pll_clock_khz);
669a5db411d85a Jeff Garzik 2006-08-29 513 return;
669a5db411d85a Jeff Garzik 2006-08-29 514 }
669a5db411d85a Jeff Garzik 2006-08-29 515
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 516 dev_dbg(host->dev, "pout_required is %ld\n", pout_required);
669a5db411d85a Jeff Garzik 2006-08-29 517
669a5db411d85a Jeff Garzik 2006-08-29 518 /* Show the current clock value of PLL control register
669a5db411d85a Jeff Garzik 2006-08-29 519 * (maybe already configured by the firmware)
669a5db411d85a Jeff Garzik 2006-08-29 520 */
d2a84f47899d1e Alan Cox 2007-09-20 @521 pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
669a5db411d85a Jeff Garzik 2006-08-29 522
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 523 dev_dbg(host->dev, "pll_ctl[%X]\n", pll_ctl);
669a5db411d85a Jeff Garzik 2006-08-29 524
669a5db411d85a Jeff Garzik 2006-08-29 525 /*
669a5db411d85a Jeff Garzik 2006-08-29 526 * Calculate the ratio of F, R and OD
669a5db411d85a Jeff Garzik 2006-08-29 527 * POUT = (F + 2) / (( R + 2) * NO)
669a5db411d85a Jeff Garzik 2006-08-29 528 */
669a5db411d85a Jeff Garzik 2006-08-29 529 if (ratio < 8600L) { /* 8.6x */
669a5db411d85a Jeff Garzik 2006-08-29 530 /* Using NO = 0x01, R = 0x0D */
669a5db411d85a Jeff Garzik 2006-08-29 531 R = 0x0d;
669a5db411d85a Jeff Garzik 2006-08-29 532 } else if (ratio < 12900L) { /* 12.9x */
669a5db411d85a Jeff Garzik 2006-08-29 533 /* Using NO = 0x01, R = 0x08 */
669a5db411d85a Jeff Garzik 2006-08-29 534 R = 0x08;
669a5db411d85a Jeff Garzik 2006-08-29 535 } else if (ratio < 16100L) { /* 16.1x */
669a5db411d85a Jeff Garzik 2006-08-29 536 /* Using NO = 0x01, R = 0x06 */
669a5db411d85a Jeff Garzik 2006-08-29 537 R = 0x06;
669a5db411d85a Jeff Garzik 2006-08-29 538 } else if (ratio < 64000L) { /* 64x */
669a5db411d85a Jeff Garzik 2006-08-29 539 R = 0x00;
669a5db411d85a Jeff Garzik 2006-08-29 540 } else {
669a5db411d85a Jeff Garzik 2006-08-29 541 /* Invalid ratio */
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 542 dev_err(host->dev, "Invalid ratio %ld, give up!\n", ratio);
669a5db411d85a Jeff Garzik 2006-08-29 543 return;
669a5db411d85a Jeff Garzik 2006-08-29 544 }
669a5db411d85a Jeff Garzik 2006-08-29 545
669a5db411d85a Jeff Garzik 2006-08-29 546 F = (ratio * (R+2)) / 1000 - 2;
669a5db411d85a Jeff Garzik 2006-08-29 547
669a5db411d85a Jeff Garzik 2006-08-29 548 if (unlikely(F < 0 || F > 127)) {
669a5db411d85a Jeff Garzik 2006-08-29 549 /* Invalid F */
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 550 dev_err(host->dev, "F[%d] invalid!\n", F);
669a5db411d85a Jeff Garzik 2006-08-29 551 return;
669a5db411d85a Jeff Garzik 2006-08-29 552 }
669a5db411d85a Jeff Garzik 2006-08-29 553
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 554 dev_dbg(host->dev, "F[%d] R[%d] ratio*1000[%ld]\n", F, R, ratio);
669a5db411d85a Jeff Garzik 2006-08-29 555
669a5db411d85a Jeff Garzik 2006-08-29 556 pll_ctl = (R << 8) | F;
669a5db411d85a Jeff Garzik 2006-08-29 557
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 558 dev_dbg(host->dev, "Writing pll_ctl[%X]\n", pll_ctl);
669a5db411d85a Jeff Garzik 2006-08-29 559
d2a84f47899d1e Alan Cox 2007-09-20 560 iowrite16(pll_ctl, mmio_base + PDC_PLL_CTL);
d2a84f47899d1e Alan Cox 2007-09-20 561 ioread16(mmio_base + PDC_PLL_CTL); /* flush */
669a5db411d85a Jeff Garzik 2006-08-29 562
669a5db411d85a Jeff Garzik 2006-08-29 563 /* Wait the PLL circuit to be stable */
b3506c7ed216dd Jia-Ju Bai 2018-01-25 564 msleep(30);
669a5db411d85a Jeff Garzik 2006-08-29 565
669a5db411d85a Jeff Garzik 2006-08-29 566 /*
669a5db411d85a Jeff Garzik 2006-08-29 567 * Show the current clock value of PLL control register
669a5db411d85a Jeff Garzik 2006-08-29 568 * (maybe configured by the firmware)
669a5db411d85a Jeff Garzik 2006-08-29 569 */
d2a84f47899d1e Alan Cox 2007-09-20 570 pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
669a5db411d85a Jeff Garzik 2006-08-29 571
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 572 dev_dbg(host->dev, "pll_ctl[%X]\n", pll_ctl);
669a5db411d85a Jeff Garzik 2006-08-29 573
669a5db411d85a Jeff Garzik 2006-08-29 574 return;
669a5db411d85a Jeff Garzik 2006-08-29 575 }
669a5db411d85a Jeff Garzik 2006-08-29 576
:::::: The code at line 521 was first introduced by commit
:::::: d2a84f47899d1efc24fa610696f7b793692279c7 pdc2027x: Switch properly to ioread/iowrite
:::::: TO: Alan Cox <alan@lxorguk.ukuu.org.uk>
:::::: CC: Jeff Garzik <jeff@garzik.org>
---
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] 3+ messages in thread
* drivers/ata/pata_pdc2027x.c:521:2: warning: Value stored to 'pll_ctl' is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-02-27 18:39 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-02-27 18:39 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 20458 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Hannes Reinecke <hare@suse.com>
CC: Damien Le Moal <damien.lemoal@opensource.wdc.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 2293be58d6a18cab800e25e42081bacb75c05752
commit: b5a5fc8b0f8175e4b3aaf182c1b23de4ccdd3347 ata: pata_pdc2027x: Replace PDPRINTK() with standard ata logging
date: 8 weeks ago
:::::: branch date: 22 hours ago
:::::: commit date: 8 weeks ago
config: riscv-randconfig-c006-20220222 (https://download.01.org/0day-ci/archive/20220228/202202280247.T92IUv1h-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b5a5fc8b0f8175e4b3aaf182c1b23de4ccdd3347
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout b5a5fc8b0f8175e4b3aaf182c1b23de4ccdd3347
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
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:303:28: note: expanded from macro '__native_word'
sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
^
kernel/events/core.c:10241:29: note: Taking false branch
struct task_struct *task = READ_ONCE(event->ctx->task);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:335:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:323:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:315:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
kernel/events/core.c:10241:29: note: Loop condition is false. Exiting loop
struct task_struct *task = READ_ONCE(event->ctx->task);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:335:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:323:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:307:2: note: expanded from macro '__compiletime_assert'
do { \
^
kernel/events/core.c:10243:2: note: 'mm' initialized to a null pointer value
struct mm_struct *mm = NULL;
^~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:10251:6: note: Assuming the condition is false
if (task == TASK_TOMBSTONE)
^~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:10251:2: note: Taking false branch
if (task == TASK_TOMBSTONE)
^
kernel/events/core.c:10254:6: note: Assuming field 'nr_file_filters' is 0
if (ifh->nr_file_filters) {
^~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:10254:2: note: Taking false branch
if (ifh->nr_file_filters) {
^
kernel/events/core.c:10262:2: note: Loop condition is false. Exiting loop
raw_spin_lock_irqsave(&ifh->lock, flags);
^
include/linux/spinlock.h:240:2: note: expanded from macro 'raw_spin_lock_irqsave'
do { \
^
kernel/events/core.c:10263:2: note: Loop condition is true. Entering loop body
list_for_each_entry(filter, &ifh->list, entry) {
^
include/linux/list.h:630:2: note: expanded from macro 'list_for_each_entry'
for (pos = list_first_entry(head, typeof(*pos), member); \
^
kernel/events/core.c:10264:7: note: Assuming field 'dentry' is non-null
if (filter->path.dentry) {
^~~~~~~~~~~~~~~~~~~
kernel/events/core.c:10264:3: note: Taking true branch
if (filter->path.dentry) {
^
kernel/events/core.c:10272:35: note: Passing null pointer value via 2nd parameter 'mm'
perf_addr_filter_apply(filter, mm, &event->addr_filter_ranges[count]);
^~
kernel/events/core.c:10272:4: note: Calling 'perf_addr_filter_apply'
perf_addr_filter_apply(filter, mm, &event->addr_filter_ranges[count]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/core.c:10225:13: note: Dereference of null pointer
for (vma = mm->mmap; vma; vma = vma->vm_next) {
^~~~~~~~
Suppressed 13 warnings (12 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.
9 warnings generated.
Suppressed 9 warnings (9 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.
Suppressed 9 warnings (9 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.
Suppressed 9 warnings (9 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.
Suppressed 9 warnings (9 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.
>> drivers/ata/pata_pdc2027x.c:521:2: warning: Value stored to 'pll_ctl' is never read [clang-analyzer-deadcode.DeadStores]
pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
^
drivers/ata/pata_pdc2027x.c:521:2: note: Value stored to 'pll_ctl' is never read
drivers/ata/pata_pdc2027x.c:570:2: warning: Value stored to 'pll_ctl' is never read [clang-analyzer-deadcode.DeadStores]
pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
^
drivers/ata/pata_pdc2027x.c:570:2: note: Value stored to 'pll_ctl' is never read
Suppressed 9 warnings (9 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.
drivers/media/dvb-core/dvb_frontend.c:355:23: warning: Value stored to 'fe' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct dvb_frontend *fe = fepriv->dvbdev->priv;
^~ ~~~~~~~~~~~~~~~~~~~~
drivers/media/dvb-core/dvb_frontend.c:355:23: note: Value stored to 'fe' during its initialization is never read
struct dvb_frontend *fe = fepriv->dvbdev->priv;
^~ ~~~~~~~~~~~~~~~~~~~~
drivers/media/dvb-core/dvb_frontend.c:1582:3: warning: Value stored to 'len' is never read [clang-analyzer-deadcode.DeadStores]
len = 1;
^ ~
drivers/media/dvb-core/dvb_frontend.c:1582:3: note: Value stored to 'len' is never read
len = 1;
^ ~
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.
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.
drivers/media/cec/core/cec-adap.c:420:3: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
cec_data_cancel(data, CEC_TX_STATUS_ABORTED);
^
drivers/media/cec/core/cec-adap.c:1665:6: note: Assuming field 'unregistered' is false
if (adap->devnode.unregistered)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:1665:2: note: Taking false branch
if (adap->devnode.unregistered)
^
drivers/media/cec/core/cec-adap.c:1668:6: note: Assuming 'log_addrs' is null
if (!log_addrs || log_addrs->num_log_addrs == 0) {
^~~~~~~~~~
drivers/media/cec/core/cec-adap.c:1668:17: note: Left side of '||' is true
if (!log_addrs || log_addrs->num_log_addrs == 0) {
^
drivers/media/cec/core/cec-adap.c:1669:3: note: Calling 'cec_adap_unconfigure'
cec_adap_unconfigure(adap);
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:1327:6: note: Assuming field 'needs_hpd' is true
if (!adap->needs_hpd ||
^~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:1327:6: note: Left side of '||' is false
drivers/media/cec/core/cec-adap.c:1328:6: note: Assuming field 'phys_addr' is equal to CEC_PHYS_ADDR_INVALID
adap->phys_addr != CEC_PHYS_ADDR_INVALID)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:1327:2: note: Taking false branch
if (!adap->needs_hpd ||
^
drivers/media/cec/core/cec-adap.c:1333:2: note: Calling 'cec_flush'
cec_flush(adap);
^~~~~~~~~~~~~~~
drivers/media/cec/core/cec-adap.c:417:2: note: Loop condition is true. Entering loop body
while (!list_empty(&adap->transmit_queue)) {
^
drivers/media/cec/core/cec-adap.c:420: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)
vim +/pll_ctl +521 drivers/ata/pata_pdc2027x.c
669a5db411d85a Jeff Garzik 2006-08-29 492
669a5db411d85a Jeff Garzik 2006-08-29 493 /**
1906cf27fcc070 Lee Jones 2021-02-01 494 * pdc_adjust_pll - Adjust the PLL input clock in Hz.
669a5db411d85a Jeff Garzik 2006-08-29 495 *
5d728824efeda6 Tejun Heo 2007-04-17 496 * @host: target ATA host
669a5db411d85a Jeff Garzik 2006-08-29 497 * @pll_clock: The input of PLL in HZ
1906cf27fcc070 Lee Jones 2021-02-01 498 * @board_idx: board identifier
669a5db411d85a Jeff Garzik 2006-08-29 499 */
5d728824efeda6 Tejun Heo 2007-04-17 500 static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int board_idx)
669a5db411d85a Jeff Garzik 2006-08-29 501 {
5d728824efeda6 Tejun Heo 2007-04-17 502 void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR];
669a5db411d85a Jeff Garzik 2006-08-29 503 u16 pll_ctl;
669a5db411d85a Jeff Garzik 2006-08-29 504 long pll_clock_khz = pll_clock / 1000;
669a5db411d85a Jeff Garzik 2006-08-29 505 long pout_required = board_idx? PDC_133_MHZ:PDC_100_MHZ;
669a5db411d85a Jeff Garzik 2006-08-29 506 long ratio = pout_required / pll_clock_khz;
669a5db411d85a Jeff Garzik 2006-08-29 507 int F, R;
669a5db411d85a Jeff Garzik 2006-08-29 508
669a5db411d85a Jeff Garzik 2006-08-29 509 /* Sanity check */
669a5db411d85a Jeff Garzik 2006-08-29 510 if (unlikely(pll_clock_khz < 5000L || pll_clock_khz > 70000L)) {
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 511 dev_err(host->dev, "Invalid PLL input clock %ldkHz, give up!\n",
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 512 pll_clock_khz);
669a5db411d85a Jeff Garzik 2006-08-29 513 return;
669a5db411d85a Jeff Garzik 2006-08-29 514 }
669a5db411d85a Jeff Garzik 2006-08-29 515
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 516 dev_dbg(host->dev, "pout_required is %ld\n", pout_required);
669a5db411d85a Jeff Garzik 2006-08-29 517
669a5db411d85a Jeff Garzik 2006-08-29 518 /* Show the current clock value of PLL control register
669a5db411d85a Jeff Garzik 2006-08-29 519 * (maybe already configured by the firmware)
669a5db411d85a Jeff Garzik 2006-08-29 520 */
d2a84f47899d1e Alan Cox 2007-09-20 @521 pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
669a5db411d85a Jeff Garzik 2006-08-29 522
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 523 dev_dbg(host->dev, "pll_ctl[%X]\n", pll_ctl);
669a5db411d85a Jeff Garzik 2006-08-29 524
669a5db411d85a Jeff Garzik 2006-08-29 525 /*
669a5db411d85a Jeff Garzik 2006-08-29 526 * Calculate the ratio of F, R and OD
669a5db411d85a Jeff Garzik 2006-08-29 527 * POUT = (F + 2) / (( R + 2) * NO)
669a5db411d85a Jeff Garzik 2006-08-29 528 */
669a5db411d85a Jeff Garzik 2006-08-29 529 if (ratio < 8600L) { /* 8.6x */
669a5db411d85a Jeff Garzik 2006-08-29 530 /* Using NO = 0x01, R = 0x0D */
669a5db411d85a Jeff Garzik 2006-08-29 531 R = 0x0d;
669a5db411d85a Jeff Garzik 2006-08-29 532 } else if (ratio < 12900L) { /* 12.9x */
669a5db411d85a Jeff Garzik 2006-08-29 533 /* Using NO = 0x01, R = 0x08 */
669a5db411d85a Jeff Garzik 2006-08-29 534 R = 0x08;
669a5db411d85a Jeff Garzik 2006-08-29 535 } else if (ratio < 16100L) { /* 16.1x */
669a5db411d85a Jeff Garzik 2006-08-29 536 /* Using NO = 0x01, R = 0x06 */
669a5db411d85a Jeff Garzik 2006-08-29 537 R = 0x06;
669a5db411d85a Jeff Garzik 2006-08-29 538 } else if (ratio < 64000L) { /* 64x */
669a5db411d85a Jeff Garzik 2006-08-29 539 R = 0x00;
669a5db411d85a Jeff Garzik 2006-08-29 540 } else {
669a5db411d85a Jeff Garzik 2006-08-29 541 /* Invalid ratio */
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 542 dev_err(host->dev, "Invalid ratio %ld, give up!\n", ratio);
669a5db411d85a Jeff Garzik 2006-08-29 543 return;
669a5db411d85a Jeff Garzik 2006-08-29 544 }
669a5db411d85a Jeff Garzik 2006-08-29 545
669a5db411d85a Jeff Garzik 2006-08-29 546 F = (ratio * (R+2)) / 1000 - 2;
669a5db411d85a Jeff Garzik 2006-08-29 547
669a5db411d85a Jeff Garzik 2006-08-29 548 if (unlikely(F < 0 || F > 127)) {
669a5db411d85a Jeff Garzik 2006-08-29 549 /* Invalid F */
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 550 dev_err(host->dev, "F[%d] invalid!\n", F);
669a5db411d85a Jeff Garzik 2006-08-29 551 return;
669a5db411d85a Jeff Garzik 2006-08-29 552 }
669a5db411d85a Jeff Garzik 2006-08-29 553
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 554 dev_dbg(host->dev, "F[%d] R[%d] ratio*1000[%ld]\n", F, R, ratio);
669a5db411d85a Jeff Garzik 2006-08-29 555
669a5db411d85a Jeff Garzik 2006-08-29 556 pll_ctl = (R << 8) | F;
669a5db411d85a Jeff Garzik 2006-08-29 557
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 558 dev_dbg(host->dev, "Writing pll_ctl[%X]\n", pll_ctl);
669a5db411d85a Jeff Garzik 2006-08-29 559
d2a84f47899d1e Alan Cox 2007-09-20 560 iowrite16(pll_ctl, mmio_base + PDC_PLL_CTL);
d2a84f47899d1e Alan Cox 2007-09-20 561 ioread16(mmio_base + PDC_PLL_CTL); /* flush */
669a5db411d85a Jeff Garzik 2006-08-29 562
669a5db411d85a Jeff Garzik 2006-08-29 563 /* Wait the PLL circuit to be stable */
b3506c7ed216dd Jia-Ju Bai 2018-01-25 564 msleep(30);
669a5db411d85a Jeff Garzik 2006-08-29 565
669a5db411d85a Jeff Garzik 2006-08-29 566 /*
669a5db411d85a Jeff Garzik 2006-08-29 567 * Show the current clock value of PLL control register
669a5db411d85a Jeff Garzik 2006-08-29 568 * (maybe configured by the firmware)
669a5db411d85a Jeff Garzik 2006-08-29 569 */
d2a84f47899d1e Alan Cox 2007-09-20 570 pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
669a5db411d85a Jeff Garzik 2006-08-29 571
b5a5fc8b0f8175 Hannes Reinecke 2021-12-21 572 dev_dbg(host->dev, "pll_ctl[%X]\n", pll_ctl);
669a5db411d85a Jeff Garzik 2006-08-29 573
669a5db411d85a Jeff Garzik 2006-08-29 574 return;
669a5db411d85a Jeff Garzik 2006-08-29 575 }
669a5db411d85a Jeff Garzik 2006-08-29 576
:::::: The code at line 521 was first introduced by commit
:::::: d2a84f47899d1efc24fa610696f7b793692279c7 pdc2027x: Switch properly to ioread/iowrite
:::::: TO: Alan Cox <alan@lxorguk.ukuu.org.uk>
:::::: CC: Jeff Garzik <jeff@garzik.org>
---
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] 3+ messages in thread
* drivers/ata/pata_pdc2027x.c:521:2: warning: Value stored to 'pll_ctl' is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-04-12 23:07 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-04-12 23:07 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 21979 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Hannes Reinecke <hare@suse.com>
CC: Damien Le Moal <damien.lemoal@opensource.wdc.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ce522ba9ef7e2d9fb22a39eb3371c0c64e2a433e
commit: b5a5fc8b0f8175e4b3aaf182c1b23de4ccdd3347 ata: pata_pdc2027x: Replace PDPRINTK() with standard ata logging
date: 3 months ago
:::::: branch date: 2 days ago
:::::: commit date: 3 months ago
config: riscv-randconfig-c006-20220411 (https://download.01.org/0day-ci/archive/20220413/202204130658.3r2GuAb7-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c6e83f560f06cdfe8aa47b248d8bdc58f947274b)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b5a5fc8b0f8175e4b3aaf182c1b23de4ccdd3347
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout b5a5fc8b0f8175e4b3aaf182c1b23de4ccdd3347
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
for (i = 0; i < rc_map->len; i++) {
^~~~~~~~~~~~~~~
drivers/media/rc/rc-main.c:388:2: note: Loop condition is true. Entering loop body
for (i = 0; i < rc_map->len; i++) {
^
drivers/media/rc/rc-main.c:389:32: note: The left operand of '==' is a garbage value
if (rc_map->scan[i].scancode == scancode)
~~~~~~~~~~~~~~~~~~~~~~~~ ^
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
drivers/regulator/core.c:1109:2: warning: Value stored to 'count' is never read [clang-analyzer-deadcode.DeadStores]
count += scnprintf(buf + count, len - count, ", %s",
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/regulator/core.c:1109:2: note: Value stored to 'count' is never read
count += scnprintf(buf + count, len - count, ", %s",
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/regulator/core.c:3792:3: warning: Value stored to 'possible_uV' is never read [clang-analyzer-deadcode.DeadStores]
possible_uV = desired_min_uV;
^ ~~~~~~~~~~~~~~
drivers/regulator/core.c:3792:3: note: Value stored to 'possible_uV' is never read
possible_uV = desired_min_uV;
^ ~~~~~~~~~~~~~~
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
drivers/input/misc/atmel_captouch.c:68:8: warning: Excessive padding in 'struct atmel_captouch_device' (75 padding bytes, where 11 is optimal).
Optimal fields order:
xfer_buf,
client,
input,
num_btn,
keycodes,
prev_btn,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct atmel_captouch_device {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
drivers/input/misc/atmel_captouch.c:68:8: note: Excessive padding in 'struct atmel_captouch_device' (75 padding bytes, where 11 is optimal). Optimal fields order: xfer_buf, client, input, num_btn, keycodes, prev_btn, consider reordering the fields or adding explicit padding members
struct atmel_captouch_device {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
>> drivers/ata/pata_pdc2027x.c:521:2: warning: Value stored to 'pll_ctl' is never read [clang-analyzer-deadcode.DeadStores]
pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
^
drivers/ata/pata_pdc2027x.c:521:2: note: Value stored to 'pll_ctl' is never read
drivers/ata/pata_pdc2027x.c:570:2: warning: Value stored to 'pll_ctl' is never read [clang-analyzer-deadcode.DeadStores]
pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
^
drivers/ata/pata_pdc2027x.c:570:2: note: Value stored to 'pll_ctl' is never read
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.
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.
7 warnings generated.
Suppressed 7 warnings (6 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.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
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.
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.
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.
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.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
drivers/i2c/busses/i2c-rk3x.c:504:9: warning: Access to field 'flags' results in a dereference of a null pointer (loaded from field 'msg') [clang-analyzer-core.NullDereference]
if (!(i2c->msg->flags & I2C_M_IGNORE_NAK))
^
drivers/i2c/busses/i2c-rk3x.c:1140:9: note: Calling 'rk3x_i2c_xfer_common'
return rk3x_i2c_xfer_common(adap, msgs, num, true);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-rk3x.c:1066:2: note: Loop condition is false. Exiting loop
spin_lock_irqsave(&i2c->lock, flags);
^
include/linux/spinlock.h:379:2: note: expanded from macro 'spin_lock_irqsave'
raw_spin_lock_irqsave(spinlock_check(lock), flags); \
^
include/linux/spinlock.h:264:3: note: expanded from macro 'raw_spin_lock_irqsave'
_raw_spin_lock_irqsave(lock, flags); \
^
include/linux/spinlock_api_up.h:68:45: note: expanded from macro '_raw_spin_lock_irqsave'
#define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
^
include/linux/spinlock_api_up.h:40:8: note: expanded from macro '__LOCK_IRQSAVE'
do { local_irq_save(flags); __LOCK(lock); } while (0)
^
include/linux/irqflags.h:237:36: note: expanded from macro 'local_irq_save'
#define local_irq_save(flags) do { raw_local_irq_save(flags); } while (0)
^
include/linux/irqflags.h:169:2: note: expanded from macro 'raw_local_irq_save'
do { \
^
drivers/i2c/busses/i2c-rk3x.c:1066:2: note: Loop condition is false. Exiting loop
spin_lock_irqsave(&i2c->lock, flags);
^
include/linux/spinlock.h:379:2: note: expanded from macro 'spin_lock_irqsave'
raw_spin_lock_irqsave(spinlock_check(lock), flags); \
^
include/linux/spinlock.h:264:3: note: expanded from macro 'raw_spin_lock_irqsave'
_raw_spin_lock_irqsave(lock, flags); \
^
include/linux/spinlock_api_up.h:68:45: note: expanded from macro '_raw_spin_lock_irqsave'
#define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
^
include/linux/spinlock_api_up.h:40:8: note: expanded from macro '__LOCK_IRQSAVE'
do { local_irq_save(flags); __LOCK(lock); } while (0)
^
include/linux/irqflags.h:237:31: note: expanded from macro 'local_irq_save'
#define local_irq_save(flags) do { raw_local_irq_save(flags); } while (0)
^
drivers/i2c/busses/i2c-rk3x.c:1066:2: note: Loop condition is false. Exiting loop
spin_lock_irqsave(&i2c->lock, flags);
^
vim +/pll_ctl +521 drivers/ata/pata_pdc2027x.c
669a5db411d85a1 Jeff Garzik 2006-08-29 492
669a5db411d85a1 Jeff Garzik 2006-08-29 493 /**
1906cf27fcc0707 Lee Jones 2021-02-01 494 * pdc_adjust_pll - Adjust the PLL input clock in Hz.
669a5db411d85a1 Jeff Garzik 2006-08-29 495 *
5d728824efeda61 Tejun Heo 2007-04-17 496 * @host: target ATA host
669a5db411d85a1 Jeff Garzik 2006-08-29 497 * @pll_clock: The input of PLL in HZ
1906cf27fcc0707 Lee Jones 2021-02-01 498 * @board_idx: board identifier
669a5db411d85a1 Jeff Garzik 2006-08-29 499 */
5d728824efeda61 Tejun Heo 2007-04-17 500 static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int board_idx)
669a5db411d85a1 Jeff Garzik 2006-08-29 501 {
5d728824efeda61 Tejun Heo 2007-04-17 502 void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR];
669a5db411d85a1 Jeff Garzik 2006-08-29 503 u16 pll_ctl;
669a5db411d85a1 Jeff Garzik 2006-08-29 504 long pll_clock_khz = pll_clock / 1000;
669a5db411d85a1 Jeff Garzik 2006-08-29 505 long pout_required = board_idx? PDC_133_MHZ:PDC_100_MHZ;
669a5db411d85a1 Jeff Garzik 2006-08-29 506 long ratio = pout_required / pll_clock_khz;
669a5db411d85a1 Jeff Garzik 2006-08-29 507 int F, R;
669a5db411d85a1 Jeff Garzik 2006-08-29 508
669a5db411d85a1 Jeff Garzik 2006-08-29 509 /* Sanity check */
669a5db411d85a1 Jeff Garzik 2006-08-29 510 if (unlikely(pll_clock_khz < 5000L || pll_clock_khz > 70000L)) {
b5a5fc8b0f8175e Hannes Reinecke 2021-12-21 511 dev_err(host->dev, "Invalid PLL input clock %ldkHz, give up!\n",
b5a5fc8b0f8175e Hannes Reinecke 2021-12-21 512 pll_clock_khz);
669a5db411d85a1 Jeff Garzik 2006-08-29 513 return;
669a5db411d85a1 Jeff Garzik 2006-08-29 514 }
669a5db411d85a1 Jeff Garzik 2006-08-29 515
b5a5fc8b0f8175e Hannes Reinecke 2021-12-21 516 dev_dbg(host->dev, "pout_required is %ld\n", pout_required);
669a5db411d85a1 Jeff Garzik 2006-08-29 517
669a5db411d85a1 Jeff Garzik 2006-08-29 518 /* Show the current clock value of PLL control register
669a5db411d85a1 Jeff Garzik 2006-08-29 519 * (maybe already configured by the firmware)
669a5db411d85a1 Jeff Garzik 2006-08-29 520 */
d2a84f47899d1ef Alan Cox 2007-09-20 @521 pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
669a5db411d85a1 Jeff Garzik 2006-08-29 522
b5a5fc8b0f8175e Hannes Reinecke 2021-12-21 523 dev_dbg(host->dev, "pll_ctl[%X]\n", pll_ctl);
669a5db411d85a1 Jeff Garzik 2006-08-29 524
669a5db411d85a1 Jeff Garzik 2006-08-29 525 /*
669a5db411d85a1 Jeff Garzik 2006-08-29 526 * Calculate the ratio of F, R and OD
669a5db411d85a1 Jeff Garzik 2006-08-29 527 * POUT = (F + 2) / (( R + 2) * NO)
669a5db411d85a1 Jeff Garzik 2006-08-29 528 */
669a5db411d85a1 Jeff Garzik 2006-08-29 529 if (ratio < 8600L) { /* 8.6x */
669a5db411d85a1 Jeff Garzik 2006-08-29 530 /* Using NO = 0x01, R = 0x0D */
669a5db411d85a1 Jeff Garzik 2006-08-29 531 R = 0x0d;
669a5db411d85a1 Jeff Garzik 2006-08-29 532 } else if (ratio < 12900L) { /* 12.9x */
669a5db411d85a1 Jeff Garzik 2006-08-29 533 /* Using NO = 0x01, R = 0x08 */
669a5db411d85a1 Jeff Garzik 2006-08-29 534 R = 0x08;
669a5db411d85a1 Jeff Garzik 2006-08-29 535 } else if (ratio < 16100L) { /* 16.1x */
669a5db411d85a1 Jeff Garzik 2006-08-29 536 /* Using NO = 0x01, R = 0x06 */
669a5db411d85a1 Jeff Garzik 2006-08-29 537 R = 0x06;
669a5db411d85a1 Jeff Garzik 2006-08-29 538 } else if (ratio < 64000L) { /* 64x */
669a5db411d85a1 Jeff Garzik 2006-08-29 539 R = 0x00;
669a5db411d85a1 Jeff Garzik 2006-08-29 540 } else {
669a5db411d85a1 Jeff Garzik 2006-08-29 541 /* Invalid ratio */
b5a5fc8b0f8175e Hannes Reinecke 2021-12-21 542 dev_err(host->dev, "Invalid ratio %ld, give up!\n", ratio);
669a5db411d85a1 Jeff Garzik 2006-08-29 543 return;
669a5db411d85a1 Jeff Garzik 2006-08-29 544 }
669a5db411d85a1 Jeff Garzik 2006-08-29 545
669a5db411d85a1 Jeff Garzik 2006-08-29 546 F = (ratio * (R+2)) / 1000 - 2;
669a5db411d85a1 Jeff Garzik 2006-08-29 547
669a5db411d85a1 Jeff Garzik 2006-08-29 548 if (unlikely(F < 0 || F > 127)) {
669a5db411d85a1 Jeff Garzik 2006-08-29 549 /* Invalid F */
b5a5fc8b0f8175e Hannes Reinecke 2021-12-21 550 dev_err(host->dev, "F[%d] invalid!\n", F);
669a5db411d85a1 Jeff Garzik 2006-08-29 551 return;
669a5db411d85a1 Jeff Garzik 2006-08-29 552 }
669a5db411d85a1 Jeff Garzik 2006-08-29 553
b5a5fc8b0f8175e Hannes Reinecke 2021-12-21 554 dev_dbg(host->dev, "F[%d] R[%d] ratio*1000[%ld]\n", F, R, ratio);
669a5db411d85a1 Jeff Garzik 2006-08-29 555
669a5db411d85a1 Jeff Garzik 2006-08-29 556 pll_ctl = (R << 8) | F;
669a5db411d85a1 Jeff Garzik 2006-08-29 557
b5a5fc8b0f8175e Hannes Reinecke 2021-12-21 558 dev_dbg(host->dev, "Writing pll_ctl[%X]\n", pll_ctl);
669a5db411d85a1 Jeff Garzik 2006-08-29 559
d2a84f47899d1ef Alan Cox 2007-09-20 560 iowrite16(pll_ctl, mmio_base + PDC_PLL_CTL);
d2a84f47899d1ef Alan Cox 2007-09-20 561 ioread16(mmio_base + PDC_PLL_CTL); /* flush */
669a5db411d85a1 Jeff Garzik 2006-08-29 562
669a5db411d85a1 Jeff Garzik 2006-08-29 563 /* Wait the PLL circuit to be stable */
b3506c7ed216dd2 Jia-Ju Bai 2018-01-25 564 msleep(30);
669a5db411d85a1 Jeff Garzik 2006-08-29 565
669a5db411d85a1 Jeff Garzik 2006-08-29 566 /*
669a5db411d85a1 Jeff Garzik 2006-08-29 567 * Show the current clock value of PLL control register
669a5db411d85a1 Jeff Garzik 2006-08-29 568 * (maybe configured by the firmware)
669a5db411d85a1 Jeff Garzik 2006-08-29 569 */
d2a84f47899d1ef Alan Cox 2007-09-20 570 pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
669a5db411d85a1 Jeff Garzik 2006-08-29 571
b5a5fc8b0f8175e Hannes Reinecke 2021-12-21 572 dev_dbg(host->dev, "pll_ctl[%X]\n", pll_ctl);
669a5db411d85a1 Jeff Garzik 2006-08-29 573
669a5db411d85a1 Jeff Garzik 2006-08-29 574 return;
669a5db411d85a1 Jeff Garzik 2006-08-29 575 }
669a5db411d85a1 Jeff Garzik 2006-08-29 576
:::::: The code at line 521 was first introduced by commit
:::::: d2a84f47899d1efc24fa610696f7b793692279c7 pdc2027x: Switch properly to ioread/iowrite
:::::: TO: Alan Cox <alan@lxorguk.ukuu.org.uk>
:::::: CC: Jeff Garzik <jeff@garzik.org>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-12 23:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-25 15:14 drivers/ata/pata_pdc2027x.c:521:2: warning: Value stored to 'pll_ctl' is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2022-02-27 18:39 kernel test robot
2022-04-12 23:07 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.