From patchwork Tue Sep 13 06:59:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tang Bin X-Patchwork-Id: 12974484 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77E13C6FA82 for ; Tue, 13 Sep 2022 07:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=MF8N5bxHjrrVO7cFcsUzWMlD8oUW0KRMI0n0N+phP+Q=; b=NNHgkvACQhGvBM tyF43J1ykd3nINdmLM1EL7KfwOZmZBy1ldwjfRUxkCWbqNr/9iB7vlZc68afx2Vdqou65Lou1D/Qu UQhuC9jHk//zM0SK/3JNJREs89XQzCMGvDGbuE+rKUpRMsUX3N5Nf9JwLSZaUju7uut3/wy26fxX2 ylXWbY7z6mHpB9rP3CphQhi3DFe08grIvsO97TBiK0jSjEGYtON+banJL2ZBp+vWwHsKjG9ztcCgg RkeZET/ACc7QuMwikylchWTOY4Fr8BWJrINAZHZd3GUCXa0APA4ez8Pdbh4Qwq9ospjE1B3X8k5Yz fQqCuB6dKrw/QssK1aeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXztI-003Hra-2Q; Tue, 13 Sep 2022 06:59:28 +0000 Received: from cmccmta2.chinamobile.com ([221.176.66.80]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXzt3-003Hh1-PS for linux-arm-kernel@lists.infradead.org; Tue, 13 Sep 2022 06:59:23 +0000 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-app06-12006 (RichMail) with SMTP id 2ee663202a2aafb-35d4c; Tue, 13 Sep 2022 14:58:50 +0800 (CST) X-RM-TRANSID: 2ee663202a2aafb-35d4c 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220912_235914_309566_B63F668D X-CRM114-Status: UNSURE ( 8.66 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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; 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 |