diff mbox series

[2/2] PCI: imx: Fix checking pd_pcie_phy device_link

Message ID 8911de1e25f5c7d8ce328b623a980f2746787a87.1548110502.git.leonard.crestez@nxp.com (mailing list archive)
State Not Applicable
Headers show
Series PCI: imx: imx6_pcie_attach_pd | expand

Commit Message

Leonard Crestez Jan. 21, 2019, 10:50 p.m. UTC
This check was completely wrong. It doesn't break anything specific
because adding the second device_link can't fail.

Fixes: 3f7cceeab895 ("PCI: imx: Add multi-pd support")

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index ac5f6ae0b254..80f843030e36 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -324,17 +324,17 @@  static int imx6_pcie_attach_pd(struct device *dev)
 
 	imx6_pcie->pd_pcie_phy = dev_pm_domain_attach_by_name(dev, "pcie_phy");
 	if (IS_ERR(imx6_pcie->pd_pcie_phy))
 		return PTR_ERR(imx6_pcie->pd_pcie_phy);
 
-	device_link_add(dev, imx6_pcie->pd_pcie_phy,
+	link = device_link_add(dev, imx6_pcie->pd_pcie_phy,
 			DL_FLAG_STATELESS |
 			DL_FLAG_PM_RUNTIME |
 			DL_FLAG_RPM_ACTIVE);
-	if (IS_ERR(link)) {
-		dev_err(dev, "Failed to add device_link to pcie_phy pd: %ld\n", PTR_ERR(link));
-		return PTR_ERR(link);
+	if (!link) {
+		dev_err(dev, "Failed to add device_link to pcie_phy pd.\n");
+		return -EINVAL;
 	}
 
 	return 0;
 }