linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: xgene: fix a mistake about cfg address
@ 2021-03-28 14:41 Dejin Zheng
  2021-03-28 15:38 ` dann frazier
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dejin Zheng @ 2021-03-28 14:41 UTC (permalink / raw)
  To: toan, lorenzo.pieralisi, robh, bhelgaas, gustavo.pimentel, linux-pci
  Cc: linux-kernel, Dejin Zheng, dann.frazier

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: dann.frazier@canonical.com
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
 drivers/pci/controller/pci-xgene.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
index 2afdc865253e..7f503dd4ff81 100644
--- a/drivers/pci/controller/pci-xgene.c
+++ b/drivers/pci/controller/pci-xgene.c
@@ -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.30.1


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

* Re: [PATCH] PCI: xgene: fix a mistake about cfg address
  2021-03-28 14:41 [PATCH] PCI: xgene: fix a mistake about cfg address Dejin Zheng
@ 2021-03-28 15:38 ` dann frazier
  2021-03-29  9:32 ` Lorenzo Pieralisi
  2021-03-30 19:19 ` Bjorn Helgaas
  2 siblings, 0 replies; 5+ messages in thread
From: dann frazier @ 2021-03-28 15:38 UTC (permalink / raw)
  To: Dejin Zheng
  Cc: toan, lorenzo.pieralisi, robh, bhelgaas, gustavo.pimentel,
	linux-pci, linux-kernel

On Sun, Mar 28, 2021 at 10:41:18PM +0800, Dejin Zheng wrote:
> 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: dann.frazier@canonical.com
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>

Tested-by: dann frazier <dann.frazier@canonical.com>

Thanks!

  -dann

> ---
>  drivers/pci/controller/pci-xgene.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
> index 2afdc865253e..7f503dd4ff81 100644
> --- a/drivers/pci/controller/pci-xgene.c
> +++ b/drivers/pci/controller/pci-xgene.c
> @@ -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;

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

* Re: [PATCH] PCI: xgene: fix a mistake about cfg address
  2021-03-28 14:41 [PATCH] PCI: xgene: fix a mistake about cfg address Dejin Zheng
  2021-03-28 15:38 ` dann frazier
@ 2021-03-29  9:32 ` Lorenzo Pieralisi
  2021-03-30 19:19 ` Bjorn Helgaas
  2 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Pieralisi @ 2021-03-29  9:32 UTC (permalink / raw)
  To: gustavo.pimentel, bhelgaas, Dejin Zheng, toan, linux-pci, robh
  Cc: Lorenzo Pieralisi, linux-kernel, dann.frazier

On Sun, 28 Mar 2021 22:41:18 +0800, Dejin Zheng wrote:
> 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

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

* Re: [PATCH] PCI: xgene: fix a mistake about cfg address
  2021-03-28 14:41 [PATCH] PCI: xgene: fix a mistake about cfg address Dejin Zheng
  2021-03-28 15:38 ` dann frazier
  2021-03-29  9:32 ` Lorenzo Pieralisi
@ 2021-03-30 19:19 ` Bjorn Helgaas
  2021-03-31  9:35   ` Lorenzo Pieralisi
  2 siblings, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2021-03-30 19:19 UTC (permalink / raw)
  To: Dejin Zheng
  Cc: toan, lorenzo.pieralisi, robh, bhelgaas, gustavo.pimentel,
	linux-pci, linux-kernel, dann.frazier

On Sun, Mar 28, 2021 at 10:41:18PM +0800, Dejin Zheng wrote:
> 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: dann.frazier@canonical.com
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>

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

  Cc: stable@vger.kernel.org	# v5.9+

> ---
>  drivers/pci/controller/pci-xgene.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
> index 2afdc865253e..7f503dd4ff81 100644
> --- a/drivers/pci/controller/pci-xgene.c
> +++ b/drivers/pci/controller/pci-xgene.c
> @@ -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.30.1
> 

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

* Re: [PATCH] PCI: xgene: fix a mistake about cfg address
  2021-03-30 19:19 ` Bjorn Helgaas
@ 2021-03-31  9:35   ` Lorenzo Pieralisi
  0 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Pieralisi @ 2021-03-31  9:35 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Dejin Zheng, toan, robh, bhelgaas, gustavo.pimentel, linux-pci,
	linux-kernel, dann.frazier

On Tue, Mar 30, 2021 at 02:19:26PM -0500, Bjorn Helgaas wrote:
> On Sun, Mar 28, 2021 at 10:41:18PM +0800, Dejin Zheng wrote:
> > 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: dann.frazier@canonical.com
> > Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> 
> This looks right to me, but since e2dcd20b1645a appeared in v5.9-rc1,
> I think it should have:
> 
>   Cc: stable@vger.kernel.org	# v5.9+

Fixed and pushed out in my pci/xgene branch.

Thanks,
Lorenzo

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

end of thread, other threads:[~2021-03-31  9:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-28 14:41 [PATCH] PCI: xgene: fix a mistake about cfg address Dejin Zheng
2021-03-28 15:38 ` dann frazier
2021-03-29  9:32 ` Lorenzo Pieralisi
2021-03-30 19:19 ` Bjorn Helgaas
2021-03-31  9:35   ` Lorenzo Pieralisi

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).