Skip to content

Commit a4ace4f

Browse files
cdleonardbjorn-helgaas
authored andcommitted
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: 3f7ccee ("PCI: imx: Add multi-pd support") Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> [lorenzo.pieralisi@arm.com: updated commit log] Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
1 parent a6093ad commit a4ace4f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/pci/controller/dwc/pci-imx6.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,13 @@ static int imx6_pcie_attach_pd(struct device *dev)
326326
if (IS_ERR(imx6_pcie->pd_pcie_phy))
327327
return PTR_ERR(imx6_pcie->pd_pcie_phy);
328328

329-
device_link_add(dev, imx6_pcie->pd_pcie_phy,
329+
link = device_link_add(dev, imx6_pcie->pd_pcie_phy,
330330
DL_FLAG_STATELESS |
331331
DL_FLAG_PM_RUNTIME |
332332
DL_FLAG_RPM_ACTIVE);
333-
if (IS_ERR(link)) {
334-
dev_err(dev, "Failed to add device_link to pcie_phy pd: %ld\n", PTR_ERR(link));
335-
return PTR_ERR(link);
333+
if (!link) {
334+
dev_err(dev, "Failed to add device_link to pcie_phy pd.\n");
335+
return -EINVAL;
336336
}
337337

338338
return 0;

0 commit comments

Comments
 (0)