Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6239469rwn; Tue, 13 Sep 2022 00:43:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR4PQDvbUeqlb0SFSi9ztdl2pcXWF+GH06H/t4Ufl2dBzfwz2gr1XXy5M3PF7SGya344q8QH X-Received: by 2002:a17:902:d503:b0:178:2663:dc8e with SMTP id b3-20020a170902d50300b001782663dc8emr12925622plg.52.1663054997772; Tue, 13 Sep 2022 00:43:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663054997; cv=none; d=google.com; s=arc-20160816; b=E7Dr7lCYqNsCs3WD1nLCubRQy03zj5ZMvN7s2BnI4NkuwXQUPFs4QWMyDGAMWrb/Yw igSj10HatT/xRp2EfPJaMWQf2Ext9AGq/wYKz7bb6cmP/jqO742TzLTubkOTMOA7pp8l H5RXFCLdhy1vZTJ2oqF4g7eQbm7s4vRGWmpHMdWtXecIyTG94egj4lBwgLVAENdo3XCj XCODl4kyn1kFHKIIk4miwN41evlWjdSLWIfAqaHJQtJC2841i4jwCKTGxOr1kNYMqd7S d/FDmedZrR12nEGKpJngDLgQ7gxWjvVj05fYwB9MwkShejBIAwK0g0fiBwudOQuVc4Wd 6GMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=xglz0vjqr0RitGgMnGnkfLMxC6SCl6nGd91QSpoaNaI=; b=gl+x22djb1Dbtgf58Vkb8Ofe5SVzTXK/5btL+oTpPuhKQOTfk3IXrd5I6a5oRhrjmP IAU3KwqQWniHz6FuYNRnetp0yKwHV/9ymVWGkdwNWEz/8CF2au+xmAmeK54dMyjicOna Lml2VFb/pP9ECXQ8R+JIHlPsSsUjtx+0X/vpuNXpVrcbIAokPuQF6N0lUYKlSyKDz/4s O+DSGu81idnFJq0h2HUn5Efn84wVAVoVoGvyA+RM6sZB8f/ZIpv7tenLJVDbjh1+oH7M qMVXO4yPoa6ASl+nJ7xHKrkuBVK0MgVWjcLwL0n/KpgYPt7x1ap9nVv5c7lLf/8ZTrCx xhVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=o7TxC+At; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u72-20020a63794b000000b004346d181b72si4032764pgc.325.2022.09.13.00.43.05; Tue, 13 Sep 2022 00:43:17 -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; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=o7TxC+At; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230512AbiIMHcD (ORCPT + 99 others); Tue, 13 Sep 2022 03:32:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230476AbiIMHcB (ORCPT ); Tue, 13 Sep 2022 03:32:01 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A92558B63; Tue, 13 Sep 2022 00:31:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xglz0vjqr0RitGgMnGnkfLMxC6SCl6nGd91QSpoaNaI=; b=o7TxC+At2Mo+ZS3vjfpbAZySLL +4QjSd4wUUiVK0sp0IUeOKe/F7SKWYJl0wtwOsWlzf9kOkgMkN9OEfLRabuDwIvtMDWDGJbp+yZGq 5M2h0hXUUwvM1PsGhGpFnG3bk128hVOfsJ+Z6MRt+K+nBJpojyHhDEpXEPGkx4o+nNzrK0N3gmgHh BtjAAedwtM/bPGovll4HLeWpGCqpeDdDlKl1/c6l/YFuMIVrbZ3vrsdheTrPXExgOS6YsPkaAojLX EKXhG7F8MkXpdaCyOUGEGb6VKpn76YrNKwO6tM5v541igx3D2BITIn+t9XuHmTs1zX59ZcltfzONA ndAr3sfA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34278) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oY0OU-0002Y5-FU; Tue, 13 Sep 2022 08:31:42 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1oY0ON-0000UN-4W; Tue, 13 Sep 2022 08:31:35 +0100 Date: Tue, 13 Sep 2022 08:31:35 +0100 From: "Russell King (Oracle)" To: Tang Bin Cc: 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, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: imx6: Fix wrong check in imx6_pcie_attach_pd() Message-ID: References: <20220913065910.15348-1-tangbin@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220913065910.15348-1-tangbin@cmss.chinamobile.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 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 On Tue, Sep 13, 2022 at 02:59:10PM +0800, Tang Bin wrote: > 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. NAK. You are clearly doing a mechanical search and replace, and then throwing out patches without a care in the world for other people to then decide whether the changes are in fact appropriate or not. Please don't do that. Please read and understand the code before you waste reviewers and developers time - otherwise you will educate reviews and developers to ignore your efforts. > 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; Your change is incorrect, as can be seen by the following if() statement, which checks for NULL here. Clearly, the explicit intention is that if dev_pm_domain_attach_by_name() returns NULL, imx6_pcie_attach_pd() does _not_ fail. So you are likely creating a regression by your change. You are likely introducing a bug rather than fixing something. This is why you must always carefully review any mechanical change. > @@ -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 | This change is unnecessary. If dev_pm_domain_attach_by_name() returns Null, then device_link_add() will also return NULL, and the check for a NULL link will then succeed. So the NULL case is already cleanly handled. So overall, your patch is unnecessary and introduces a bug rather than fixing it. Therefore, you can discard the patch in its entirety. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!