[kbuild] Re: [PATCH] PCI: pciehp: Add check for DL_ACTIVE bit in pciehp_check_link_status()

From: Dan Carpenter
Date: Wed Oct 07 2020 - 05:30:46 EST


Hi Sanjay,

url: https://github.com/0day-ci/linux/commits/Sanjay-R-Mehta/PCI-pciehp-Add-check-for-DL_ACTIVE-bit-in-pciehp_check_link_status/20201007-022638
base: 549738f15da0e5a00275977623be199fbbf7df50
config: x86_64-randconfig-m001-20201005 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/pci/hotplug/pciehp_hpc.c:313 pciehp_check_link_status() warn: maybe use && instead of &

vim +313 drivers/pci/hotplug/pciehp_hpc.c

82a9e79ef132cbf Kenji Kaneshige 2009-09-15 290 int pciehp_check_link_status(struct controller *ctrl)
^1da177e4c3f415 Linus Torvalds 2005-04-16 291 {
cd84d34074f5659 Bjorn Helgaas 2013-05-09 292 struct pci_dev *pdev = ctrl_dev(ctrl);
1a84b99ccbb954c Bjorn Helgaas 2013-12-14 293 bool found;
^1da177e4c3f415 Linus Torvalds 2005-04-16 294 u16 lnk_status;
^1da177e4c3f415 Linus Torvalds 2005-04-16 295
f0157160b359b1d Keith Busch 2018-09-20 296 if (!pcie_wait_for_link(pdev, true))
f0157160b359b1d Keith Busch 2018-09-20 297 return -1;
f18e9625e02bb3e Kenji Kaneshige 2008-10-22 298
f496648b99f8f7f Alexandru Gagniuc 2019-10-25 299 if (ctrl->inband_presence_disabled)
f496648b99f8f7f Alexandru Gagniuc 2019-10-25 300 pcie_wait_for_presence(pdev);
f496648b99f8f7f Alexandru Gagniuc 2019-10-25 301
2f5d8e4ff947ad6 Yinghai Lu 2012-01-27 302 found = pci_bus_check_dev(ctrl->pcie->port->subordinate,
2f5d8e4ff947ad6 Yinghai Lu 2012-01-27 303 PCI_DEVFN(0, 0));
0027cb3e1947d0f Kenji Kaneshige 2011-11-10 304
6c35a1ac3da63a7 Lukas Wunner 2018-07-19 305 /* ignore link or presence changes up to this point */
6c35a1ac3da63a7 Lukas Wunner 2018-07-19 306 if (found)
6c35a1ac3da63a7 Lukas Wunner 2018-07-19 307 atomic_and(~(PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC),
6c35a1ac3da63a7 Lukas Wunner 2018-07-19 308 &ctrl->pending_events);
6c35a1ac3da63a7 Lukas Wunner 2018-07-19 309
1a84b99ccbb954c Bjorn Helgaas 2013-12-14 310 pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status);
7f2feec140f1f1e Taku Izumi 2008-09-05 311 ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status);
818dc520d6f8472 Sanjay R Mehta 2020-10-06 312 if (((lnk_status & PCI_EXP_LNKSTA_LT) &
^
This won't ever be true. PCI_EXP_LNKSTA_LT is 0x0800. It needs to be
&&.

818dc520d6f8472 Sanjay R Mehta 2020-10-06 @313 !(lnk_status & PCI_EXP_DPC_CAP_DL_ACTIVE)) ||
322162a71bd9fc4 Kenji Kaneshige 2008-12-19 314 !(lnk_status & PCI_EXP_LNKSTA_NLW)) {
3784e0c6b02d4fa Bjorn Helgaas 2015-06-15 315 ctrl_err(ctrl, "link training error: status %#06x\n",
3784e0c6b02d4fa Bjorn Helgaas 2015-06-15 316 lnk_status);
1a84b99ccbb954c Bjorn Helgaas 2013-12-14 317 return -1;
^1da177e4c3f415 Linus Torvalds 2005-04-16 318 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 319
fdbd3ce9efb3a04 Yinghai Lu 2011-11-07 320 pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
fdbd3ce9efb3a04 Yinghai Lu 2011-11-07 321
1a84b99ccbb954c Bjorn Helgaas 2013-12-14 322 if (!found)
1a84b99ccbb954c Bjorn Helgaas 2013-12-14 323 return -1;
2f5d8e4ff947ad6 Yinghai Lu 2012-01-27 324
1a84b99ccbb954c Bjorn Helgaas 2013-12-14 325 return 0;
^1da177e4c3f415 Linus Torvalds 2005-04-16 326 }

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@xxxxxxxxxxxx
To unsubscribe send an email to kbuild-leave@xxxxxxxxxxxx