[PATCH v2] PCI: mediatek: Fix wrong operator used
Ryder Lee
ryder.lee at mediatek.com
Tue Nov 3 18:10:11 EST 2020
SoCs like MT2701 and MT7623 use mtk_pcie_startup_port() to compute "func",
but from the code, the result we get is incorrect.
#define PCI_FUNC(devfn) ((devfn) & 0x07)
func = PCI_FUNC(port->slot << 3)
The "func" is always 0, which results in other functions may not have been
configured correctly. (i.e. FC credits and FTS)
Addresses-Coverity-ID: 1437218 ("Wrong operator used")
Signed-off-by: Ryder Lee <ryder.lee at mediatek.com>
---
V2 - revise commit log
---
drivers/pci/controller/pcie-mediatek.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
index cf4c18f0c25a..1980b01cee35 100644
--- a/drivers/pci/controller/pcie-mediatek.c
+++ b/drivers/pci/controller/pcie-mediatek.c
@@ -760,7 +760,7 @@ static struct pci_ops mtk_pcie_ops = {
static int mtk_pcie_startup_port(struct mtk_pcie_port *port)
{
struct mtk_pcie *pcie = port->pcie;
- u32 func = PCI_FUNC(port->slot << 3);
+ u32 func = PCI_FUNC(port->slot);
u32 slot = PCI_SLOT(port->slot << 3);
u32 val;
int err;
--
2.18.0
More information about the Linux-mediatek
mailing list