linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: imx6: Fix wrong check in imx6_pcie_attach_pd()
@ 2022-09-13  6:59 Tang Bin
  2022-09-13  7:31 ` Russell King (Oracle)
  2022-09-13  7:39 ` Lucas Stach
  0 siblings, 2 replies; 6+ messages in thread
From: Tang Bin @ 2022-09-13  6:59 UTC (permalink / raw)
  To: hongxing.zhu, l.stach, lorenzo.pieralisi, robh, kw, shawnguo,
	bhelgaas, s.hauer, kernel, festevam, linux-imx
  Cc: linux-pci, linux-arm-kernel, linux-kernel, Tang Bin

In the function imx6_pcie_attach_pd(),
dev_pm_domain_attach_by_name() may return NULL in some cases,
so IS_ERR() doesn't meet the requirements. Thus fix it.

Fixes: 3f7cceeab895 ("PCI: imx: Add multi-pd support")
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 6619e3caf..65d6ebbba 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -337,8 +337,8 @@ static int imx6_pcie_attach_pd(struct device *dev)
 		return 0;
 
 	imx6_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie");
-	if (IS_ERR(imx6_pcie->pd_pcie))
-		return PTR_ERR(imx6_pcie->pd_pcie);
+	if (IS_ERR_OR_NULL(imx6_pcie->pd_pcie))
+		return PTR_ERR(imx6_pcie->pd_pcie) ? : -ENODATA;
 	/* Do nothing when power domain missing */
 	if (!imx6_pcie->pd_pcie)
 		return 0;
@@ -352,8 +352,8 @@ 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);
+	if (IS_ERR_OR_NULL(imx6_pcie->pd_pcie_phy))
+		return PTR_ERR(imx6_pcie->pd_pcie_phy) ? : -ENODATA;
 
 	link = device_link_add(dev, imx6_pcie->pd_pcie_phy,
 			DL_FLAG_STATELESS |
-- 
2.20.1.windows.1




_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-13  8:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13  6:59 [PATCH] PCI: imx6: Fix wrong check in imx6_pcie_attach_pd() Tang Bin
2022-09-13  7:31 ` Russell King (Oracle)
2022-09-13  7:36   ` Russell King (Oracle)
2022-09-13  8:29   ` Arnd Bergmann
2022-09-13  7:39 ` Lucas Stach
2022-09-13  7:46   ` Russell King (Oracle)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).