Skip to contentSkip to conversation

PCI: xgene: fix a mistake about cfg address

PATCH Applied Dejin Zheng 4 participants 5 messages Mar 28, 2021 – Mar 31, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: xgene: fix a mistake about cfg address

It has a wrong modification to the xgene driver by the commit e2dcd20b1645a. it use devm_platform_ioremap_resource_byname() to simplify codes and remove the res variable, But the following code needs to use this res variable, So after this commit, the port->cfg_addr will get a wrong address. Now, revert it.

Fixes e2dcd20b1645a ("PCI: controller: Convert to devm_platform_ioremap_resource_byname()")
Reported-by [email protected]
---
 drivers/pci/controller/pci-xgene.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-xgene.c +2 -1
index 2afdc865253e..7f503dd4ff81 100644
@@ -354,7 +354,8 @@ static int xgene_pcie_map_reg(struct xgene_pcie_port *port,
 	if (IS_ERR(port->csr_base))
 		return PTR_ERR(port->csr_base);
 
-	port->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
+	port->cfg_base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(port->cfg_base))
 		return PTR_ERR(port->cfg_base);
 	port->cfg_addr = res->start;
Signature · 1 line
2.30.1
Tested-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dejin Zheng

It has a wrong modification to the xgene driver by the commit e2dcd20b1645a. it use devm_platform_ioremap_resource_byname() to simplify codes and remove the res variable, But the following code needs to use this res variable, So after this commit, the port->cfg_addr will get a wrong address. Now, revert it.

Fixes e2dcd20b1645a ("PCI: controller: Convert to devm_platform_ioremap_resource_byname()")
Reported-by [email protected]

Thanks!

-dann

Quoted 18 lines
---
 drivers/pci/controller/pci-xgene.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-xgene.c +2 -1
index 2afdc865253e..7f503dd4ff81 100644
@@ -354,7 +354,8 @@ static int xgene_pcie_map_reg(struct xgene_pcie_port *port,
 	if (IS_ERR(port->csr_base))
 		return PTR_ERR(port->csr_base);
 
-	port->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
+	port->cfg_base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(port->cfg_base))
 		return PTR_ERR(port->cfg_base);
 	port->cfg_addr = res->start;
#2 lore raw
In reply to Dejin Zheng
Quoted 5 lines · Dejin Zheng

It has a wrong modification to the xgene driver by the commit e2dcd20b1645a. it use devm_platform_ioremap_resource_byname() to simplify codes and remove the res variable, But the following code needs to use this res variable, So after this commit, the port->cfg_addr will get a wrong address. Now, revert it.

Applied to pci/xgene, thanks!

[1/1] PCI: xgene: Fix cfg resource mapping

      https://git.kernel.org/lpieralisi/pci/c/f243b619b4

Thanks,
Lorenzo

#3 lore raw
In reply to Dejin Zheng
Quoted 9 lines · Dejin Zheng

It has a wrong modification to the xgene driver by the commit e2dcd20b1645a. it use devm_platform_ioremap_resource_byname() to simplify codes and remove the res variable, But the following code needs to use this res variable, So after this commit, the port->cfg_addr will get a wrong address. Now, revert it.

Fixes e2dcd20b1645a ("PCI: controller: Convert to devm_platform_ioremap_resource_byname()")
Reported-by [email protected]

This looks right to me, but since e2dcd20b1645a appeared in v5.9-rc1, I think it should have:

Quoted 21 lines
---
 drivers/pci/controller/pci-xgene.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-xgene.c +2 -1
index 2afdc865253e..7f503dd4ff81 100644
@@ -354,7 +354,8 @@ static int xgene_pcie_map_reg(struct xgene_pcie_port *port,
 	if (IS_ERR(port->csr_base))
 		return PTR_ERR(port->csr_base);
 
-	port->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
+	port->cfg_base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(port->cfg_base))
 		return PTR_ERR(port->cfg_base);
 	port->cfg_addr = res->start;
Signature · 1 line
2.30.1
#4 lore raw
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Dejin Zheng

It has a wrong modification to the xgene driver by the commit e2dcd20b1645a. it use devm_platform_ioremap_resource_byname() to simplify codes and remove the res variable, But the following code needs to use this res variable, So after this commit, the port->cfg_addr will get a wrong address. Now, revert it.

Quoted 8 lines
Quoted 3 lines
Fixes e2dcd20b1645a ("PCI: controller: Convert to devm_platform_ioremap_resource_byname()")
Reported-by [email protected]

This looks right to me, but since e2dcd20b1645a appeared in v5.9-rc1, I think it should have:

Fixed and pushed out in my pci/xgene branch.

Thanks,
Lorenzo