From nobody Mon Apr 6 00:32:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E0ECC54EE9 for ; Tue, 13 Sep 2022 06:59:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230133AbiIMG66 (ORCPT ); Tue, 13 Sep 2022 02:58:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230211AbiIMG6y (ORCPT ); Tue, 13 Sep 2022 02:58:54 -0400 X-Greylist: delayed 783 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 12 Sep 2022 23:58:53 PDT Received: from cmccmta3.chinamobile.com (cmccmta3.chinamobile.com [221.176.66.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 080F610FF2 for ; Mon, 12 Sep 2022 23:58:52 -0700 (PDT) X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from spf.mail.chinamobile.com (unknown[172.16.121.11]) by rmmx-syy-dmz-app09-12009 (RichMail) with SMTP id 2ee963202a2ad70-36aec; Tue, 13 Sep 2022 14:58:50 +0800 (CST) X-RM-TRANSID: 2ee963202a2ad70-36aec X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.108.79.98]) by rmsmtp-syy-appsvr06-12006 (RichMail) with SMTP id 2ee663202a27ec8-50ddd; Tue, 13 Sep 2022 14:58:50 +0800 (CST) X-RM-TRANSID: 2ee663202a27ec8-50ddd From: Tang Bin To: hongxing.zhu@nxp.com, l.stach@pengutronix.de, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, shawnguo@kernel.org, bhelgaas@google.com, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Tang Bin Subject: [PATCH] PCI: imx6: Fix wrong check in imx6_pcie_attach_pd() Date: Tue, 13 Sep 2022 14:59:10 +0800 Message-Id: <20220913065910.15348-1-tangbin@cmss.chinamobile.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- 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; =20 imx6_pcie->pd_pcie =3D 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) } =20 imx6_pcie->pd_pcie_phy =3D 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; =20 link =3D device_link_add(dev, imx6_pcie->pd_pcie_phy, DL_FLAG_STATELESS | --=20 2.20.1.windows.1