linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pci: mediatek: fix wrong operator used
@ 2020-10-27 16:51 Ryder Lee
  2020-11-03 21:53 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Ryder Lee @ 2020-10-27 16:51 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-mediatek, Ryder Lee

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@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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-03 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27 16:51 [PATCH] pci: mediatek: fix wrong operator used Ryder Lee
2020-11-03 21:53 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).