Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6222366rwn; Tue, 13 Sep 2022 00:21:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR68nI8SOpsxS9252sL3kI3n6OYnyZjI/Z4Kp1Tp6Vfx5rzMq7+t95rUPcvtRbBZ16X/xeOu X-Received: by 2002:a63:1302:0:b0:438:e83a:acd5 with SMTP id i2-20020a631302000000b00438e83aacd5mr8737689pgl.510.1663053704672; Tue, 13 Sep 2022 00:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663053704; cv=none; d=google.com; s=arc-20160816; b=JPJMo1uXw+vtL2TihXh290KIMDQmdkPeKNu+iqaPlr2Yt+7jH3mBaAvHIF+pkD5VeV SXIvJ+MOe91mOnFSPz07ylaTzrKEq74OeT0aqO0eK0+H/ZsqBnBEsqdPbcfVS/3eYdxE tfrlXT20hHbFNHEfvGsRopnbzaRjCLI9MzKxdt8gfPkIPGrraZL6plGIJqkeMql46qbo /jf6Csd4tKQ5orWwlKEFKtfk2qV0/WCgRWlLU0wV9p18vbunpMph7wrEpUnW/PWFtoZz 5oxleXMmcKKdU9ntAqg68NyYmbKhnwMg6bQ14qmFCUwrP+Wfx2bWm0YlEx10Zxtmekkr jCJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=c4rddrb2CeEVz6q8FnYIoEzrcshC9SsAyUAZQsYrGqE=; b=v0rFqpdbMMuMTkXhoYjIhoXhfHw9bDMtuU03nDqasBeOGuaJiHh+K9o1idEDwYQl7v vENVwxXlyHlDa2kuuJxXcrF7O6DsT39gq/Mqlx2RDqanB5YJo//sB1PXCvx3rXs1itIn aBgn/lMc9SQ3VmIraVS7imwg9yppJ2qK7mXclNAXhoBnlmOZqx8n84fomKaId77B5CXn TQPtGvsrgkoAY9RY9XkzrkRXn2B6pHUHNson17p6Rf+Wv2Ufj6kALB5MaOU+Ii6vccP7 FU343lueDLPCuHsdtkqJDgB6Sll/UEbDkkHap71E7hUzgl3+tdXnd6JkCbubYNHcikjG 6QTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v14-20020a17090a4ece00b001fe35ddd963si10433587pjl.103.2022.09.13.00.21.32; Tue, 13 Sep 2022 00:21:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230479AbiIMG65 (ORCPT + 99 others); Tue, 13 Sep 2022 02:58:57 -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: 8bit X-Spam-Status: No, score=2.0 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_SBL_CSS,RCVD_IN_VALIDITY_RPBL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 | -- 2.20.1.windows.1