linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: rcar: Clean up PHY init on failure
@ 2018-05-25 18:33 Marek Vasut
  2018-05-25 19:27 ` Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Marek Vasut @ 2018-05-25 18:33 UTC (permalink / raw)
  To: linux-pci
  Cc: Marek Vasut, Geert Uytterhoeven, Lorenzo Pieralisi, Phil Edworthy,
	Simon Horman, Wolfram Sang, linux-renesas-soc

If the Gen3 PHY fails to power up, the code does not undo the
initialization caused by phy_init(). Add the missing failure
handling to the rcar_pcie_phy_init_gen3() function.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Phil Edworthy <phil.edworthy@renesas.com>
Cc: Simon Horman <horms+renesas@verge.net.au>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-renesas-soc@vger.kernel.org
Fixes: 517ca93a7159 ("PCI: rcar: Add R-Car gen3 PHY support")
---
 drivers/pci/host/pcie-rcar.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 695781934f0a..477bf40cc031 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -678,7 +678,11 @@ static int rcar_pcie_phy_init_gen3(struct rcar_pcie *pcie)
 	if (err)
 		return err;
 
-	return phy_power_on(pcie->phy);
+	err = phy_power_on(pcie->phy);
+	if (err)
+		phy_exit(pcie->phy);
+
+	return err;
 }
 
 static int rcar_msi_alloc(struct rcar_msi *chip)
-- 
2.16.2

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

* Re: [PATCH] PCI: rcar: Clean up PHY init on failure
  2018-05-25 18:33 [PATCH] PCI: rcar: Clean up PHY init on failure Marek Vasut
@ 2018-05-25 19:27 ` Geert Uytterhoeven
  2018-05-28  9:33   ` Simon Horman
  2018-05-26 10:05 ` Sergei Shtylyov
  2018-06-29 13:39 ` Lorenzo Pieralisi
  2 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2018-05-25 19:27 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Lorenzo Pieralisi,
	Phil Edworthy, Simon Horman, Wolfram Sang, Linux-Renesas,
	Sergei Shtylyov

CC Sergei

On Fri, May 25, 2018 at 8:33 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> If the Gen3 PHY fails to power up, the code does not undo the
> initialization caused by phy_init(). Add the missing failure
> handling to the rcar_pcie_phy_init_gen3() function.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Phil Edworthy <phil.edworthy@renesas.com>
> Cc: Simon Horman <horms+renesas@verge.net.au>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: linux-renesas-soc@vger.kernel.org
> Fixes: 517ca93a7159 ("PCI: rcar: Add R-Car gen3 PHY support")

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> ---
>  drivers/pci/host/pcie-rcar.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
> index 695781934f0a..477bf40cc031 100644
> --- a/drivers/pci/host/pcie-rcar.c
> +++ b/drivers/pci/host/pcie-rcar.c
> @@ -678,7 +678,11 @@ static int rcar_pcie_phy_init_gen3(struct rcar_pcie *pcie)
>         if (err)
>                 return err;
>
> -       return phy_power_on(pcie->phy);
> +       err = phy_power_on(pcie->phy);
> +       if (err)
> +               phy_exit(pcie->phy);
> +
> +       return err;
>  }
>
>  static int rcar_msi_alloc(struct rcar_msi *chip)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] PCI: rcar: Clean up PHY init on failure
  2018-05-25 18:33 [PATCH] PCI: rcar: Clean up PHY init on failure Marek Vasut
  2018-05-25 19:27 ` Geert Uytterhoeven
@ 2018-05-26 10:05 ` Sergei Shtylyov
  2018-06-29 13:39 ` Lorenzo Pieralisi
  2 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2018-05-26 10:05 UTC (permalink / raw)
  To: Marek Vasut, linux-pci
  Cc: Marek Vasut, Geert Uytterhoeven, Lorenzo Pieralisi, Phil Edworthy,
	Simon Horman, Wolfram Sang, linux-renesas-soc

On 5/25/2018 9:33 PM, Marek Vasut wrote:

> If the Gen3 PHY fails to power up, the code does not undo the
> initialization caused by phy_init(). Add the missing failure
> handling to the rcar_pcie_phy_init_gen3() function.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Phil Edworthy <phil.edworthy@renesas.com>
> Cc: Simon Horman <horms+renesas@verge.net.au>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: linux-renesas-soc@vger.kernel.org
> Fixes: 517ca93a7159 ("PCI: rcar: Add R-Car gen3 PHY support")
[...]

    Oops, it's my sloppy coding again. Sorry about that...

MBR, Sergei

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

* Re: [PATCH] PCI: rcar: Clean up PHY init on failure
  2018-05-25 19:27 ` Geert Uytterhoeven
@ 2018-05-28  9:33   ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2018-05-28  9:33 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Marek Vasut, linux-pci, Marek Vasut, Geert Uytterhoeven,
	Lorenzo Pieralisi, Phil Edworthy, Wolfram Sang, Linux-Renesas,
	Sergei Shtylyov

On Fri, May 25, 2018 at 09:27:42PM +0200, Geert Uytterhoeven wrote:
> CC Sergei
> 
> On Fri, May 25, 2018 at 8:33 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> > If the Gen3 PHY fails to power up, the code does not undo the
> > initialization caused by phy_init(). Add the missing failure
> > handling to the rcar_pcie_phy_init_gen3() function.
> >
> > Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> > Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > Cc: Phil Edworthy <phil.edworthy@renesas.com>
> > Cc: Simon Horman <horms+renesas@verge.net.au>
> > Cc: Wolfram Sang <wsa@the-dreams.de>
> > Cc: linux-renesas-soc@vger.kernel.org
> > Fixes: 517ca93a7159 ("PCI: rcar: Add R-Car gen3 PHY support")
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Acked-by: Simon Horman <horms+renesas@verge.net.au>

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

* Re: [PATCH] PCI: rcar: Clean up PHY init on failure
  2018-05-25 18:33 [PATCH] PCI: rcar: Clean up PHY init on failure Marek Vasut
  2018-05-25 19:27 ` Geert Uytterhoeven
  2018-05-26 10:05 ` Sergei Shtylyov
@ 2018-06-29 13:39 ` Lorenzo Pieralisi
  2 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Pieralisi @ 2018-06-29 13:39 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Phil Edworthy,
	Simon Horman, Wolfram Sang, linux-renesas-soc

On Fri, May 25, 2018 at 08:33:26PM +0200, Marek Vasut wrote:
> If the Gen3 PHY fails to power up, the code does not undo the
> initialization caused by phy_init(). Add the missing failure
> handling to the rcar_pcie_phy_init_gen3() function.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Phil Edworthy <phil.edworthy@renesas.com>
> Cc: Simon Horman <horms+renesas@verge.net.au>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: linux-renesas-soc@vger.kernel.org
> Fixes: 517ca93a7159 ("PCI: rcar: Add R-Car gen3 PHY support")
> ---
>  drivers/pci/host/pcie-rcar.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Applied to pci/controller-fixes to be tentatively merged for
-rc4, thanks.

Lorenzo

> diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
> index 695781934f0a..477bf40cc031 100644
> --- a/drivers/pci/host/pcie-rcar.c
> +++ b/drivers/pci/host/pcie-rcar.c
> @@ -678,7 +678,11 @@ static int rcar_pcie_phy_init_gen3(struct rcar_pcie *pcie)
>  	if (err)
>  		return err;
>  
> -	return phy_power_on(pcie->phy);
> +	err = phy_power_on(pcie->phy);
> +	if (err)
> +		phy_exit(pcie->phy);
> +
> +	return err;
>  }
>  
>  static int rcar_msi_alloc(struct rcar_msi *chip)
> -- 
> 2.16.2
> 

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

end of thread, other threads:[~2018-06-29 13:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-25 18:33 [PATCH] PCI: rcar: Clean up PHY init on failure Marek Vasut
2018-05-25 19:27 ` Geert Uytterhoeven
2018-05-28  9:33   ` Simon Horman
2018-05-26 10:05 ` Sergei Shtylyov
2018-06-29 13:39 ` 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).