Skip to contentSkip to conversation

PCI: artpec6: Remove surplus break statement after return

PATCH Superseded Krzysztof Wilczyński 2 participants 3 messages Jul 1, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: artpec6: Remove surplus break statement after return

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.

---
 drivers/pci/controller/dwc/pcie-artpec6.c | 1 -
 1 file changed, 1 deletion(-)
drivers/pci/controller/dwc/pcie-artpec6.c +0 -1
index 597c282f586c..739871bece75 100644
@@ -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);
Signature · 1 line
2.32.0
#1 lore raw
Quoted 5 lines · Krzysztof Wilczyński

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

Quoted 7 lines

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.

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.

Quoted 9 lines
---
 drivers/pci/controller/dwc/pcie-artpec6.c | 1 -
 1 file changed, 1 deletion(-)
drivers/pci/controller/dwc/pcie-artpec6.c +0 -0
index 597c282f586c..739871bece75 100644

drivers/pci/controller/dwc/pcie-artpec6.c static int artpec6_pcie_probe(struct platform_device *pdev) · line 448

Quoted 5 lines
drivers/pci/controller/dwc/pcie-artpec6.c +0 -1
@@ -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.

Quoted 5 lines
drivers/pci/controller/dwc/pcie-artpec6.c +0 -0
 	default:
 		dev_err(dev, "INVALID device type %d\n", artpec6_pcie->mode);
Signature · 1 line
2.32.0
#2 lore raw

Hi Bjorn,

[...]

Quoted 6 lines

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!

[...]

Quoted 11 lines

drivers/pci/controller/dwc/pcie-artpec6.c static int artpec6_pcie_probe(struct platform_device *pdev) · line 448

Quoted 5 lines
drivers/pci/controller/dwc/pcie-artpec6.c +0 -1
 		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