linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: hisi: fix the hisi_pcie_cfg_read bug when size=4
@ 2015-11-27  4:58 Dongdong Liu
  2015-11-30  5:25 ` Zhou Wang
  2015-12-04 22:43 ` Bjorn Helgaas
  0 siblings, 2 replies; 7+ messages in thread
From: Dongdong Liu @ 2015-11-27  4:58 UTC (permalink / raw)
  To: wangzhou1, linux-pci
  Cc: bhelgaas, gabriele.paoloni, qiujiang, zhangjukuo, haifeng.wei,
	yisen.zhuang, liudongdong3

Current hisi_pcie_cfg_read code read the RC configuration space,
this has a problem that the output parameter "*val" have not been
assigned when size=4, so we fix the bug by "*val = reg_val" when size=4.

Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
 drivers/pci/host/pcie-hisi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/host/pcie-hisi.c b/drivers/pci/host/pcie-hisi.c
index 35457ec..da677b1 100644
--- a/drivers/pci/host/pcie-hisi.c
+++ b/drivers/pci/host/pcie-hisi.c
@@ -61,7 +61,9 @@ static int hisi_pcie_cfg_read(struct pcie_port *pp, int where, int size,
 		*val = *(u8 __force *) walker;
 	else if (size == 2)
 		*val = *(u16 __force *) walker;
-	else if (size != 4)
+	else if (size == 4)
+		*val = reg_val;
+	else
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 
 	return PCIBIOS_SUCCESSFUL;
-- 
1.9.1


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

end of thread, other threads:[~2015-12-17 18:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-27  4:58 [PATCH] PCI: hisi: fix the hisi_pcie_cfg_read bug when size=4 Dongdong Liu
2015-11-30  5:25 ` Zhou Wang
2015-12-04 22:43 ` Bjorn Helgaas
2015-12-09 16:16   ` Bjorn Helgaas
2015-12-09 20:36     ` Zhou Wang
2015-12-17 10:52       ` Zhou Wang
2015-12-17 18:43         ` 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).