PCI: tegra194: Fix tegra_pcie_ep_raise_msi_irq() ill-defined shift
authorJon Hunter <jonathanh@nvidia.com>
Fri, 18 Jun 2021 16:02:19 +0000 (17:02 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 28 Jun 2021 23:26:46 +0000 (18:26 -0500)
commitf67092eff2bd40650aad54a1a1910160f41d864a
tree2191a3078e045f12416f30f3e87ef65938094572
parentc4bf1f25c6c187864681d5ad4dd1fa92f62d5d32
PCI: tegra194: Fix tegra_pcie_ep_raise_msi_irq() ill-defined shift

tegra_pcie_ep_raise_msi_irq() shifted a signed 32-bit value left by 31
bits.  The behavior of this is implementation-defined.

Replace the shift by BIT(), which is well-defined.

Found by cppcheck:

  $ cppcheck --enable=all drivers/pci/controller/dwc/pcie-tegra194.c
  Checking drivers/pci/controller/dwc/pcie-tegra194.c ...

  drivers/pci/controller/dwc/pcie-tegra194.c:1829:23: portability: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour. See condition at line 1826.  [shiftTooManyBitsSigned]

  appl_writel(pcie, (1 << irq), APPL_MSI_CTRL_1);
                     ^

[bhelgaas: commit log]
Link: https://lore.kernel.org/r/20210618160219.303092-1-jonathanh@nvidia.com
Fixes: c57247f940e8 ("PCI: tegra: Add support for PCIe endpoint mode in Tegra194")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/controller/dwc/pcie-tegra194.c