linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: aardvark: Indicate error in 'val' when config read fails
@ 2020-06-01 13:03 Pali Rohár
  2020-06-19 10:56 ` Pali Rohár
  0 siblings, 1 reply; 5+ messages in thread
From: Pali Rohár @ 2020-06-01 13:03 UTC (permalink / raw)
  To: Bjorn Helgaas, Thomas Petazzoni, Lorenzo Pieralisi,
	Andrew Murray, Marek Behún, Remi Pommarel,
	Tomasz Maciej Nowak, Xogium
  Cc: linux-pci, linux-kernel, linux-arm-kernel

Most callers of config read do not check for return value. But most of the
ones that do, checks for error indication in 'val' variable.

This patch updates error handling in advk_pcie_rd_conf() function. If PIO
transfer fails then 'val' variable is set to 0xffffffff which indicates
failture.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/pci/controller/pci-aardvark.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index 53a4cfd7d377..783a7f1f2c44 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -691,8 +691,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
 	advk_writel(pcie, 1, PIO_START);
 
 	ret = advk_pcie_wait_pio(pcie);
-	if (ret < 0)
+	if (ret < 0) {
+		*val = 0xffffffff;
 		return PCIBIOS_SET_FAILED;
+	}
 
 	advk_pcie_check_pio_status(pcie);
 
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] PCI: aardvark: Indicate error in 'val' when config read fails
  2020-06-01 13:03 [PATCH] PCI: aardvark: Indicate error in 'val' when config read fails Pali Rohár
@ 2020-06-19 10:56 ` Pali Rohár
  2020-07-07 13:53   ` Lorenzo Pieralisi
  0 siblings, 1 reply; 5+ messages in thread
From: Pali Rohár @ 2020-06-19 10:56 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Bjorn Helgaas, Thomas Petazzoni, Rob Herring,
	Andrew Murray, Marek Behún, Remi Pommarel,
	Tomasz Maciej Nowak, Xogium
  Cc: linux-pci, linux-kernel, linux-arm-kernel

Hello Lorenzo! Could you please review this patch?

On Monday 01 June 2020 15:03:15 Pali Rohár wrote:
> Most callers of config read do not check for return value. But most of the
> ones that do, checks for error indication in 'val' variable.
> 
> This patch updates error handling in advk_pcie_rd_conf() function. If PIO
> transfer fails then 'val' variable is set to 0xffffffff which indicates
> failture.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

I should add credit for Bjorn as he found this issue

Reported-by: Bjorn Helgaas <helgaas@kernel.org>

> ---
>  drivers/pci/controller/pci-aardvark.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
> index 53a4cfd7d377..783a7f1f2c44 100644
> --- a/drivers/pci/controller/pci-aardvark.c
> +++ b/drivers/pci/controller/pci-aardvark.c
> @@ -691,8 +691,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
>  	advk_writel(pcie, 1, PIO_START);
>  
>  	ret = advk_pcie_wait_pio(pcie);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		*val = 0xffffffff;
>  		return PCIBIOS_SET_FAILED;
> +	}
>  
>  	advk_pcie_check_pio_status(pcie);
>  
> -- 
> 2.20.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] PCI: aardvark: Indicate error in 'val' when config read fails
  2020-06-19 10:56 ` Pali Rohár
@ 2020-07-07 13:53   ` Lorenzo Pieralisi
  2020-07-07 14:02     ` Pali Rohár
  0 siblings, 1 reply; 5+ messages in thread
From: Lorenzo Pieralisi @ 2020-07-07 13:53 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Tomasz Maciej Nowak, Rob Herring, linux-pci, Xogium,
	linux-kernel, Marek Behún, Remi Pommarel, Bjorn Helgaas,
	Thomas Petazzoni, linux-arm-kernel, Andrew Murray

On Fri, Jun 19, 2020 at 12:56:18PM +0200, Pali Rohár wrote:
> Hello Lorenzo! Could you please review this patch?
> 
> On Monday 01 June 2020 15:03:15 Pali Rohár wrote:
> > Most callers of config read do not check for return value. But most of the
> > ones that do, checks for error indication in 'val' variable.
> > 
> > This patch updates error handling in advk_pcie_rd_conf() function. If PIO
> > transfer fails then 'val' variable is set to 0xffffffff which indicates
> > failture.
> > 
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> 
> I should add credit for Bjorn as he found this issue

Could you provide a lore archive link to the relevant
discussion please ? I will apply it then.

Lorenzo

> Reported-by: Bjorn Helgaas <helgaas@kernel.org>
> 
> > ---
> >  drivers/pci/controller/pci-aardvark.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
> > index 53a4cfd7d377..783a7f1f2c44 100644
> > --- a/drivers/pci/controller/pci-aardvark.c
> > +++ b/drivers/pci/controller/pci-aardvark.c
> > @@ -691,8 +691,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
> >  	advk_writel(pcie, 1, PIO_START);
> >  
> >  	ret = advk_pcie_wait_pio(pcie);
> > -	if (ret < 0)
> > +	if (ret < 0) {
> > +		*val = 0xffffffff;
> >  		return PCIBIOS_SET_FAILED;
> > +	}
> >  
> >  	advk_pcie_check_pio_status(pcie);
> >  
> > -- 
> > 2.20.1
> > 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] PCI: aardvark: Indicate error in 'val' when config read fails
  2020-07-07 13:53   ` Lorenzo Pieralisi
@ 2020-07-07 14:02     ` Pali Rohár
  2020-07-07 14:49       ` Lorenzo Pieralisi
  0 siblings, 1 reply; 5+ messages in thread
From: Pali Rohár @ 2020-07-07 14:02 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: Tomasz Maciej Nowak, Rob Herring, linux-pci, Xogium,
	linux-kernel, Marek Behún, Remi Pommarel, Bjorn Helgaas,
	Thomas Petazzoni, linux-arm-kernel, Andrew Murray

On Tuesday 07 July 2020 14:53:11 Lorenzo Pieralisi wrote:
> On Fri, Jun 19, 2020 at 12:56:18PM +0200, Pali Rohár wrote:
> > Hello Lorenzo! Could you please review this patch?
> > 
> > On Monday 01 June 2020 15:03:15 Pali Rohár wrote:
> > > Most callers of config read do not check for return value. But most of the
> > > ones that do, checks for error indication in 'val' variable.
> > > 
> > > This patch updates error handling in advk_pcie_rd_conf() function. If PIO
> > > transfer fails then 'val' variable is set to 0xffffffff which indicates
> > > failture.
> > > 
> > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > 
> > I should add credit for Bjorn as he found this issue
> 
> Could you provide a lore archive link to the relevant
> discussion please ? I will apply it then.

Hello Lorenzo! Here is link to the Bjorn's email:
https://lore.kernel.org/linux-pci/20200528162604.GA323482@bjorn-Precision-5520/

> Lorenzo
> 
> > Reported-by: Bjorn Helgaas <helgaas@kernel.org>
> > 
> > > ---
> > >  drivers/pci/controller/pci-aardvark.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
> > > index 53a4cfd7d377..783a7f1f2c44 100644
> > > --- a/drivers/pci/controller/pci-aardvark.c
> > > +++ b/drivers/pci/controller/pci-aardvark.c
> > > @@ -691,8 +691,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
> > >  	advk_writel(pcie, 1, PIO_START);
> > >  
> > >  	ret = advk_pcie_wait_pio(pcie);
> > > -	if (ret < 0)
> > > +	if (ret < 0) {
> > > +		*val = 0xffffffff;
> > >  		return PCIBIOS_SET_FAILED;
> > > +	}
> > >  
> > >  	advk_pcie_check_pio_status(pcie);
> > >  
> > > -- 
> > > 2.20.1
> > > 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] PCI: aardvark: Indicate error in 'val' when config read fails
  2020-07-07 14:02     ` Pali Rohár
@ 2020-07-07 14:49       ` Lorenzo Pieralisi
  0 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Pieralisi @ 2020-07-07 14:49 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Tomasz Maciej Nowak, Rob Herring, linux-pci, Xogium,
	linux-kernel, Marek Behún, Remi Pommarel, Bjorn Helgaas,
	Thomas Petazzoni, linux-arm-kernel, Andrew Murray

On Tue, Jul 07, 2020 at 04:02:44PM +0200, Pali Rohár wrote:
> On Tuesday 07 July 2020 14:53:11 Lorenzo Pieralisi wrote:
> > On Fri, Jun 19, 2020 at 12:56:18PM +0200, Pali Rohár wrote:
> > > Hello Lorenzo! Could you please review this patch?
> > > 
> > > On Monday 01 June 2020 15:03:15 Pali Rohár wrote:
> > > > Most callers of config read do not check for return value. But most of the
> > > > ones that do, checks for error indication in 'val' variable.
> > > > 
> > > > This patch updates error handling in advk_pcie_rd_conf() function. If PIO
> > > > transfer fails then 'val' variable is set to 0xffffffff which indicates
> > > > failture.
> > > > 
> > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > 
> > > I should add credit for Bjorn as he found this issue
> > 
> > Could you provide a lore archive link to the relevant
> > discussion please ? I will apply it then.
> 
> Hello Lorenzo! Here is link to the Bjorn's email:
> https://lore.kernel.org/linux-pci/20200528162604.GA323482@bjorn-Precision-5520/

Thanks applied to pci/aardvark.

Lorenzo

> > Lorenzo
> > 
> > > Reported-by: Bjorn Helgaas <helgaas@kernel.org>
> > > 
> > > > ---
> > > >  drivers/pci/controller/pci-aardvark.c | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
> > > > index 53a4cfd7d377..783a7f1f2c44 100644
> > > > --- a/drivers/pci/controller/pci-aardvark.c
> > > > +++ b/drivers/pci/controller/pci-aardvark.c
> > > > @@ -691,8 +691,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
> > > >  	advk_writel(pcie, 1, PIO_START);
> > > >  
> > > >  	ret = advk_pcie_wait_pio(pcie);
> > > > -	if (ret < 0)
> > > > +	if (ret < 0) {
> > > > +		*val = 0xffffffff;
> > > >  		return PCIBIOS_SET_FAILED;
> > > > +	}
> > > >  
> > > >  	advk_pcie_check_pio_status(pcie);
> > > >  
> > > > -- 
> > > > 2.20.1
> > > > 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-07-07 14:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 13:03 [PATCH] PCI: aardvark: Indicate error in 'val' when config read fails Pali Rohár
2020-06-19 10:56 ` Pali Rohár
2020-07-07 13:53   ` Lorenzo Pieralisi
2020-07-07 14:02     ` Pali Rohár
2020-07-07 14:49       ` 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).