1 From 93972d18bbaba6f34e21742400b6e7461edc4837 Mon Sep 17 00:00:00 2001
2 From: Markus Elfring <elfring@users.sourceforge.net>
3 Date: Sun, 28 Jun 2015 16:42:04 +0200
4 Subject: [PATCH] PCI: iproc: Delete unnecessary checks before phy calls
6 The functions phy_exit() and phy_power_off() test whether their argument is
7 NULL and then return immediately. Thus the test around the calls is not
10 This issue was detected by using the Coccinelle software.
12 [bhelgaas: also phy_init() and phy_power_on(), as Ray Jui suggested]
13 [bhelgaas: also remove tests in iproc_pcie_remove()]
14 Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
15 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
16 Reviewed-by: Ray Jui <rjui@broadcom.com>
18 drivers/pci/host/pcie-iproc.c | 34 +++++++++++++---------------------
19 1 file changed, 13 insertions(+), 21 deletions(-)
21 --- a/drivers/pci/host/pcie-iproc.c
22 +++ b/drivers/pci/host/pcie-iproc.c
23 @@ -191,19 +191,16 @@ int iproc_pcie_setup(struct iproc_pcie *
24 if (!pcie || !pcie->dev || !pcie->base)
28 - ret = phy_init(pcie->phy);
30 - dev_err(pcie->dev, "unable to initialize PCIe PHY\n");
34 - ret = phy_power_on(pcie->phy);
36 - dev_err(pcie->dev, "unable to power on PCIe PHY\n");
39 + ret = phy_init(pcie->phy);
41 + dev_err(pcie->dev, "unable to initialize PCIe PHY\n");
45 + ret = phy_power_on(pcie->phy);
47 + dev_err(pcie->dev, "unable to power on PCIe PHY\n");
51 iproc_pcie_reset(pcie);
52 @@ -239,12 +236,9 @@ err_rm_root_bus:
53 pci_remove_root_bus(bus);
57 - phy_power_off(pcie->phy);
58 + phy_power_off(pcie->phy);
61 - phy_exit(pcie->phy);
63 + phy_exit(pcie->phy);
66 EXPORT_SYMBOL(iproc_pcie_setup);
67 @@ -254,10 +248,8 @@ int iproc_pcie_remove(struct iproc_pcie
68 pci_stop_root_bus(pcie->root_bus);
69 pci_remove_root_bus(pcie->root_bus);
72 - phy_power_off(pcie->phy);
73 - phy_exit(pcie->phy);
75 + phy_power_off(pcie->phy);
76 + phy_exit(pcie->phy);