drivers/pci/controller/dwc/pcie-designware.c:309:52: sparse: cast truncates bits from constant value (ffffffff7fffffff becomes 7fffffff)

From: kbuild test robot
Date: Fri Mar 15 2019 - 11:50:23 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f261c4e529dac5608a604d3dd3ae1cd2adf23c89
commit: 0e11faa48b07a063289d65363015a3d51ca4c337 PCI: dwc: Make use of BIT() in constant definitions
date: 2 weeks ago
reproduce:
# apt-get install sparse
git checkout 0e11faa48b07a063289d65363015a3d51ca4c337
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'


sparse warnings: (new ones prefixed by >>)

>> drivers/pci/controller/dwc/pcie-designware.c:309:52: sparse: cast truncates bits from constant value (ffffffff7fffffff becomes 7fffffff)

vim +309 drivers/pci/controller/dwc/pcie-designware.c

291
292 void dw_pcie_disable_atu(struct dw_pcie *pci, int index,
293 enum dw_pcie_region_type type)
294 {
295 int region;
296
297 switch (type) {
298 case DW_PCIE_REGION_INBOUND:
299 region = PCIE_ATU_REGION_INBOUND;
300 break;
301 case DW_PCIE_REGION_OUTBOUND:
302 region = PCIE_ATU_REGION_OUTBOUND;
303 break;
304 default:
305 return;
306 }
307
308 dw_pcie_writel_dbi(pci, PCIE_ATU_VIEWPORT, region | index);
> 309 dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, (u32)~PCIE_ATU_ENABLE);
310 }
311

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation