[PATCH] pci: mediatek: fix wrong operator used
Ryder Lee
ryder.lee at mediatek.com
Tue Oct 27 12:51:48 EDT 2020
Fix the issue reported by Coverity:
Wrong operator used (CONSTANT_EXPRESSION_RESULT) operator_confusion:
(port->slot << 3) & 7 is always 0 regardless of the values of its operands.
This occurs as an initializer.
Signed-off-by: Ryder Lee <ryder.lee at mediatek.com>
---
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