Commit a4ace4fa authored by Leonard Crestez's avatar Leonard Crestez Committed by Bjorn Helgaas

PCI: imx: Fix checking pd_pcie_phy device link addition

The check on the device_link_add() return value is wrong;
this leads to erroneous code execution, so fix it.

Fixes: 3f7cceea ("PCI: imx: Add multi-pd support")
Signed-off-by: default avatarLeonard Crestez <leonard.crestez@nxp.com>
[lorenzo.pieralisi@arm.com: updated commit log]
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
parent a6093ad7
...@@ -326,13 +326,13 @@ static int imx6_pcie_attach_pd(struct device *dev) ...@@ -326,13 +326,13 @@ static int imx6_pcie_attach_pd(struct device *dev)
if (IS_ERR(imx6_pcie->pd_pcie_phy)) if (IS_ERR(imx6_pcie->pd_pcie_phy))
return PTR_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_STATELESS |
DL_FLAG_PM_RUNTIME | DL_FLAG_PM_RUNTIME |
DL_FLAG_RPM_ACTIVE); DL_FLAG_RPM_ACTIVE);
if (IS_ERR(link)) { if (!link) {
dev_err(dev, "Failed to add device_link to pcie_phy pd: %ld\n", PTR_ERR(link)); dev_err(dev, "Failed to add device_link to pcie_phy pd.\n");
return PTR_ERR(link); return -EINVAL;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment