Wrong LTR-related check in nbif_v6_3_1_program_ltr()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In nbif_v6_3_1_program_ltr() (and maybe other functions as well) you have
the following:

pcie_capability_read_word(adev->pdev, PCI_EXP_DEVCTL2, &devctl2);

if (adev->pdev->ltr_path == (devctl2 & PCI_EXP_DEVCTL2_LTR_EN))
	return;

if (adev->pdev->ltr_path)
	pcie_capability_set_word(adev->pdev, PCI_EXP_DEVCTL2, PCI_EXP_DEVCTL2_LTR_EN);
else
	pcie_capability_clear_word(adev->pdev, PCI_EXP_DEVCTL2, PCI_EXP_DEVCTL2_LTR_EN);

The comparison to (devctl2 & PCI_EXP_DEVCTL2_LTR_EN) looks wrong, as this expression
can only be 0 or 0x400. I think what you want is
if (adev->pdev->ltr_path == !!(devctl2 & PCI_EXP_DEVCTL2_LTR_EN))

In general I wonder whether the code part is needed and why pci_configure_ltr()
in PCI core isn't sufficient for you.





[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux