linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: tegra: Fix reporting GPIO error value
@ 2020-04-14 10:25 Pali Rohár
  2020-04-14 11:31 ` Michał Mirosław
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Pali Rohár @ 2020-04-14 10:25 UTC (permalink / raw)
  To: Thierry Reding, Lorenzo Pieralisi, Andrew Murray
  Cc: Bjorn Helgaas, Jonathan Hunter, linux-tegra, linux-pci, linux-kernel

Error code is stored in rp->reset_gpio and not in err variable.

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

diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index 0e03cef72840..378d5a8773c7 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -2314,8 +2314,8 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
 			if (PTR_ERR(rp->reset_gpio) == -ENOENT) {
 				rp->reset_gpio = NULL;
 			} else {
-				dev_err(dev, "failed to get reset GPIO: %d\n",
-					err);
+				dev_err(dev, "failed to get reset GPIO: %ld\n",
+					PTR_ERR(rp->reset_gpio));
 				return PTR_ERR(rp->reset_gpio);
 			}
 		}
-- 
2.20.1


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

* Re: [PATCH] PCI: tegra: Fix reporting GPIO error value
  2020-04-14 10:25 [PATCH] PCI: tegra: Fix reporting GPIO error value Pali Rohár
@ 2020-04-14 11:31 ` Michał Mirosław
  2020-04-15 11:17   ` Pali Rohár
  2020-04-14 13:51 ` Thierry Reding
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Michał Mirosław @ 2020-04-14 11:31 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Thierry Reding, Lorenzo Pieralisi, Andrew Murray, Bjorn Helgaas,
	Jonathan Hunter, linux-tegra, linux-pci, linux-kernel

On Tue, Apr 14, 2020 at 12:25:12PM +0200, Pali Rohár wrote:
> Error code is stored in rp->reset_gpio and not in err variable.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  drivers/pci/controller/pci-tegra.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
> index 0e03cef72840..378d5a8773c7 100644
> --- a/drivers/pci/controller/pci-tegra.c
> +++ b/drivers/pci/controller/pci-tegra.c
> @@ -2314,8 +2314,8 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
>  			if (PTR_ERR(rp->reset_gpio) == -ENOENT) {
>  				rp->reset_gpio = NULL;
>  			} else {
> -				dev_err(dev, "failed to get reset GPIO: %d\n",
> -					err);
> +				dev_err(dev, "failed to get reset GPIO: %ld\n",
> +					PTR_ERR(rp->reset_gpio));
>  				return PTR_ERR(rp->reset_gpio);
>  			}
>  		}

You can use %pe directly on the pointer for added benefit of translation
of the error to a name.

Best Regards,
Michał Mirosław

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

* Re: [PATCH] PCI: tegra: Fix reporting GPIO error value
  2020-04-14 10:25 [PATCH] PCI: tegra: Fix reporting GPIO error value Pali Rohár
  2020-04-14 11:31 ` Michał Mirosław
@ 2020-04-14 13:51 ` Thierry Reding
  2020-05-07 19:44 ` Rob Herring
  2020-05-11  9:47 ` Lorenzo Pieralisi
  3 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2020-04-14 13:51 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Lorenzo Pieralisi, Andrew Murray, Bjorn Helgaas, Jonathan Hunter,
	linux-tegra, linux-pci, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

On Tue, Apr 14, 2020 at 12:25:12PM +0200, Pali Rohár wrote:
> Error code is stored in rp->reset_gpio and not in err variable.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  drivers/pci/controller/pci-tegra.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

With or without Michał's suggestion:

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] PCI: tegra: Fix reporting GPIO error value
  2020-04-14 11:31 ` Michał Mirosław
@ 2020-04-15 11:17   ` Pali Rohár
  2020-04-15 16:49     ` Michał Mirosław
  0 siblings, 1 reply; 7+ messages in thread
From: Pali Rohár @ 2020-04-15 11:17 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: Thierry Reding, Lorenzo Pieralisi, Andrew Murray, Bjorn Helgaas,
	Jonathan Hunter, linux-tegra, linux-pci, linux-kernel

On Tuesday 14 April 2020 13:31:04 Michał Mirosław wrote:
> On Tue, Apr 14, 2020 at 12:25:12PM +0200, Pali Rohár wrote:
> > Error code is stored in rp->reset_gpio and not in err variable.
> > 
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > ---
> >  drivers/pci/controller/pci-tegra.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
> > index 0e03cef72840..378d5a8773c7 100644
> > --- a/drivers/pci/controller/pci-tegra.c
> > +++ b/drivers/pci/controller/pci-tegra.c
> > @@ -2314,8 +2314,8 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
> >  			if (PTR_ERR(rp->reset_gpio) == -ENOENT) {
> >  				rp->reset_gpio = NULL;
> >  			} else {
> > -				dev_err(dev, "failed to get reset GPIO: %d\n",
> > -					err);
> > +				dev_err(dev, "failed to get reset GPIO: %ld\n",
> > +					PTR_ERR(rp->reset_gpio));
> >  				return PTR_ERR(rp->reset_gpio);
> >  			}
> >  		}
> 
> You can use %pe directly on the pointer for added benefit of translation
> of the error to a name.

Well, I do not know what is the current preferred style of error
messages. On lot of places I see just numeric error numbers.

I did not wanted to change behavior of driver, I just fixed code to
report correct error value.

I do not have this hardware, so I cannot test this change. I just
spotted this problem when I was looking at other PCI controller drivers
how they issue PERST# signal to endpoint cards.

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

* Re: [PATCH] PCI: tegra: Fix reporting GPIO error value
  2020-04-15 11:17   ` Pali Rohár
@ 2020-04-15 16:49     ` Michał Mirosław
  0 siblings, 0 replies; 7+ messages in thread
From: Michał Mirosław @ 2020-04-15 16:49 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Thierry Reding, Lorenzo Pieralisi, Andrew Murray, Bjorn Helgaas,
	Jonathan Hunter, linux-tegra, linux-pci, linux-kernel

On Wed, Apr 15, 2020 at 01:17:36PM +0200, Pali Rohár wrote:
> On Tuesday 14 April 2020 13:31:04 Michał Mirosław wrote:
> > On Tue, Apr 14, 2020 at 12:25:12PM +0200, Pali Rohár wrote:
> > > Error code is stored in rp->reset_gpio and not in err variable.a
[...]
> > > -				dev_err(dev, "failed to get reset GPIO: %d\n",
> > > -					err);
> > > +				dev_err(dev, "failed to get reset GPIO: %ld\n",
> > > +					PTR_ERR(rp->reset_gpio));
> > >  				return PTR_ERR(rp->reset_gpio);
> > >  			}
> > >  		}
> > 
> > You can use %pe directly on the pointer for added benefit of translation
> > of the error to a name.
> 
> Well, I do not know what is the current preferred style of error
> messages. On lot of places I see just numeric error numbers.

%pe is quite a recent addition to the kernel (since v5.3).

Best Regards
Michał Mirosław

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

* Re: [PATCH] PCI: tegra: Fix reporting GPIO error value
  2020-04-14 10:25 [PATCH] PCI: tegra: Fix reporting GPIO error value Pali Rohár
  2020-04-14 11:31 ` Michał Mirosław
  2020-04-14 13:51 ` Thierry Reding
@ 2020-05-07 19:44 ` Rob Herring
  2020-05-11  9:47 ` Lorenzo Pieralisi
  3 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2020-05-07 19:44 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Thierry Reding, Lorenzo Pieralisi, Andrew Murray, Bjorn Helgaas,
	Jonathan Hunter, linux-tegra, linux-pci, linux-kernel

On Tue, 14 Apr 2020 12:25:12 +0200, =?UTF-8?q?Pali=20Roh=C3=A1r?= wrote:
> Error code is stored in rp->reset_gpio and not in err variable.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  drivers/pci/controller/pci-tegra.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH] PCI: tegra: Fix reporting GPIO error value
  2020-04-14 10:25 [PATCH] PCI: tegra: Fix reporting GPIO error value Pali Rohár
                   ` (2 preceding siblings ...)
  2020-05-07 19:44 ` Rob Herring
@ 2020-05-11  9:47 ` Lorenzo Pieralisi
  3 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Pieralisi @ 2020-05-11  9:47 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Thierry Reding, Andrew Murray, Bjorn Helgaas, Jonathan Hunter,
	linux-tegra, linux-pci, linux-kernel

On Tue, Apr 14, 2020 at 12:25:12PM +0200, Pali Rohár wrote:
> Error code is stored in rp->reset_gpio and not in err variable.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  drivers/pci/controller/pci-tegra.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied to pci/tegra, thanks.

Lorenzo

> diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
> index 0e03cef72840..378d5a8773c7 100644
> --- a/drivers/pci/controller/pci-tegra.c
> +++ b/drivers/pci/controller/pci-tegra.c
> @@ -2314,8 +2314,8 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
>  			if (PTR_ERR(rp->reset_gpio) == -ENOENT) {
>  				rp->reset_gpio = NULL;
>  			} else {
> -				dev_err(dev, "failed to get reset GPIO: %d\n",
> -					err);
> +				dev_err(dev, "failed to get reset GPIO: %ld\n",
> +					PTR_ERR(rp->reset_gpio));
>  				return PTR_ERR(rp->reset_gpio);
>  			}
>  		}
> -- 
> 2.20.1
> 

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

end of thread, other threads:[~2020-05-11  9:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14 10:25 [PATCH] PCI: tegra: Fix reporting GPIO error value Pali Rohár
2020-04-14 11:31 ` Michał Mirosław
2020-04-15 11:17   ` Pali Rohár
2020-04-15 16:49     ` Michał Mirosław
2020-04-14 13:51 ` Thierry Reding
2020-05-07 19:44 ` Rob Herring
2020-05-11  9:47 ` 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).