Commit 93972d18 authored by Markus Elfring's avatar Markus Elfring Committed by Bjorn Helgaas
Browse files

PCI: iproc: Delete unnecessary checks before phy calls



The functions phy_exit() and phy_power_off() test whether their argument is
NULL and then return immediately.  Thus the test around the calls is not
needed.

This issue was detected by using the Coccinelle software.

[bhelgaas: also phy_init() and phy_power_on(), as Ray Jui suggested]
[bhelgaas: also remove tests in iproc_pcie_remove()]
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarRay Jui <rjui@broadcom.com>
parent bc0195aa
Loading
Loading
Loading
Loading
+13 −21
Original line number Diff line number Diff line
@@ -191,7 +191,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
	if (!pcie || !pcie->dev || !pcie->base)
		return -EINVAL;

	if (pcie->phy) {
	ret = phy_init(pcie->phy);
	if (ret) {
		dev_err(pcie->dev, "unable to initialize PCIe PHY\n");
@@ -204,8 +203,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
		goto err_exit_phy;
	}

	}

	iproc_pcie_reset(pcie);

	pcie->sysdata.private_data = pcie;
@@ -239,12 +236,9 @@ err_rm_root_bus:
	pci_remove_root_bus(bus);

err_power_off_phy:
	if (pcie->phy)
	phy_power_off(pcie->phy);
err_exit_phy:
	if (pcie->phy)
	phy_exit(pcie->phy);

	return ret;
}
EXPORT_SYMBOL(iproc_pcie_setup);
@@ -254,10 +248,8 @@ int iproc_pcie_remove(struct iproc_pcie *pcie)
	pci_stop_root_bus(pcie->root_bus);
	pci_remove_root_bus(pcie->root_bus);

	if (pcie->phy) {
	phy_power_off(pcie->phy);
	phy_exit(pcie->phy);
	}

	return 0;
}