All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: artpec6: Remove surplus break statement after return
@ 2021-07-01 19:16 Krzysztof Wilczyński
  2021-07-01 19:56 ` Bjorn Helgaas
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Wilczyński @ 2021-07-01 19:16 UTC (permalink / raw)
  To: Jesper Nilsson; +Cc: Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring, linux-pci

As part of code refactoring completed in the commit a0fd361db8e5 ("PCI:
dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common
code") the function artpec6_add_pcie_ep() has been removed and the call
to the dw_pcie_ep_init() has been moved into artpec6_pcie_probe().

This change left a break statement behind that is not needed any more as
as the function artpec6_pcie_probe() return immediately after making
a call to dw_pcie_ep_init().

Thus remove this surplus break statement that became a dead code.

Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
---
 drivers/pci/controller/dwc/pcie-artpec6.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-artpec6.c b/drivers/pci/controller/dwc/pcie-artpec6.c
index 597c282f586c..739871bece75 100644
--- a/drivers/pci/controller/dwc/pcie-artpec6.c
+++ b/drivers/pci/controller/dwc/pcie-artpec6.c
@@ -445,7 +445,6 @@ static int artpec6_pcie_probe(struct platform_device *pdev)
 		pci->ep.ops = &pcie_ep_ops;
 
 		return dw_pcie_ep_init(&pci->ep);
-		break;
 	}
 	default:
 		dev_err(dev, "INVALID device type %d\n", artpec6_pcie->mode);
-- 
2.32.0


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

* Re: [PATCH] PCI: artpec6: Remove surplus break statement after return
  2021-07-01 19:16 [PATCH] PCI: artpec6: Remove surplus break statement after return Krzysztof Wilczyński
@ 2021-07-01 19:56 ` Bjorn Helgaas
  2021-07-01 20:50   ` Krzysztof Wilczyński
  0 siblings, 1 reply; 3+ messages in thread
From: Bjorn Helgaas @ 2021-07-01 19:56 UTC (permalink / raw)
  To: Krzysztof Wilczyński
  Cc: Jesper Nilsson, Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring, linux-pci

On Thu, Jul 01, 2021 at 07:16:40PM +0000, Krzysztof Wilczyński wrote:
> As part of code refactoring completed in the commit a0fd361db8e5 ("PCI:
> dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common
> code") the function artpec6_add_pcie_ep() has been removed and the call
> to the dw_pcie_ep_init() has been moved into artpec6_pcie_probe().
> 
> This change left a break statement behind that is not needed any more as
> as the function artpec6_pcie_probe() return immediately after making
> a call to dw_pcie_ep_init().
> 
> Thus remove this surplus break statement that became a dead code.
> 
> Signed-off-by: Krzysztof Wilczyński <kw@linux.com>

According to

  $ git grep -n -A1 "return.*;" drivers/pci

there's at least one more instance in
drivers/pci/controller/dwc/pcie-designware-plat.c.

> ---
>  drivers/pci/controller/dwc/pcie-artpec6.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-artpec6.c b/drivers/pci/controller/dwc/pcie-artpec6.c
> index 597c282f586c..739871bece75 100644
> --- a/drivers/pci/controller/dwc/pcie-artpec6.c
> +++ b/drivers/pci/controller/dwc/pcie-artpec6.c
> @@ -445,7 +445,6 @@ static int artpec6_pcie_probe(struct platform_device *pdev)
>  		pci->ep.ops = &pcie_ep_ops;
>  
>  		return dw_pcie_ep_init(&pci->ep);
> -		break;
>  	}

Not related to your patch, but I'm not really a fan of the block here
(needed because of the local "u32 val" declaration) because we end up
with two close braces at the same indent level.  I'd rather declare
the variable at the top with the other local variables and dispense
with the braces.

>  	default:
>  		dev_err(dev, "INVALID device type %d\n", artpec6_pcie->mode);
> -- 
> 2.32.0
> 

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

* Re: [PATCH] PCI: artpec6: Remove surplus break statement after return
  2021-07-01 19:56 ` Bjorn Helgaas
@ 2021-07-01 20:50   ` Krzysztof Wilczyński
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Wilczyński @ 2021-07-01 20:50 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jesper Nilsson, Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring, linux-pci

Hi Bjorn,

[...]
> According to
> 
>   $ git grep -n -A1 "return.*;" drivers/pci
> 
> there's at least one more instance in
> drivers/pci/controller/dwc/pcie-designware-plat.c.

Nice find!  I will send a patch shortly.  Thank you!

[...]
> >  		pci->ep.ops = &pcie_ep_ops;
> >  
> >  		return dw_pcie_ep_init(&pci->ep);
> > -		break;
> >  	}
> 
> Not related to your patch, but I'm not really a fan of the block here
> (needed because of the local "u32 val" declaration) because we end up
> with two close braces at the same indent level.  I'd rather declare
> the variable at the top with the other local variables and dispense
> with the braces.

No problem!  I will sent v2 to take care of this too in the same time.

	Krzysztof

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

end of thread, other threads:[~2021-07-01 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01 19:16 [PATCH] PCI: artpec6: Remove surplus break statement after return Krzysztof Wilczyński
2021-07-01 19:56 ` Bjorn Helgaas
2021-07-01 20:50   ` Krzysztof Wilczyński

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.