[PATCH] PCI: designware: fix dw_pcie_cfg_write

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

 



From: gabriele paoloni <gabriele.paoloni@xxxxxxxxxx>

Currently in dw_pcie_cfg_write() if the input size is 2 bytes
the address offset is wrongly calculated as we mask also bit0
of "where" input parameter. Instead we should mask all bits of
"where" except bit0 and bit1.

Signed-off-by: Gabriele Paoloni <gabriele.paoloni@xxxxxxxxxx>
---
 drivers/pci/host/pcie-designware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index 69486be..a27f536 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -99,7 +99,7 @@ int dw_pcie_cfg_write(void __iomem *addr, int where, int size, u32 val)
 	if (size == 4)
 		writel(val, addr);
 	else if (size == 2)
-		writew(val, addr + (where & 2));
+		writew(val, addr + (where & 3));
 	else if (size == 1)
 		writeb(val, addr + (where & 3));
 	else
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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