Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp491496iob; Wed, 11 May 2022 20:18:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLqg5d+4E6+3/BglOf+0mNfEB8Q7XQye/BBJukqdnh88MOR+Hs2eBf1mn5LfHV8OHZtnzn X-Received: by 2002:a17:906:3fd1:b0:6ef:606f:e5c5 with SMTP id k17-20020a1709063fd100b006ef606fe5c5mr27234333ejj.441.1652325525940; Wed, 11 May 2022 20:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652325525; cv=none; d=google.com; s=arc-20160816; b=x0iVIcqv6EHaYPNxE4C4lmHmD+kaWZb0gJ4eq1hqgXZG8/3aQMAuh5DjAvOQiEyQdp lJVC2Z6RId24qoW1E4VNr/mNkIJN4S3HX6gTK2LaLV/6mdzI34UApXHJjfSWVttIvirH k3WMmxDhf58OP7JG/+i6NyxGd1ymC38rGKhgo1kUk/ApXlYArYHSwFwq/fwj4x7146Ib UDMii2Vq0mrMM5ZzhC0r9ca3bMWHY1iI/HZiKQMFHREG7PzDNyAtZ4CWsvFBSzV7C/8o CXrnIZiDCeM7fA0k/7YJcXqCldhesJLGBiSHWzJ5ABl8Zh/WTfPp6bQvxbWTjiSJi+qw 5Nig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=3SLye1/78qTCasyWqVpamtK+V/M8tCB0I7pe4qjwxMg=; b=zeuqF2PyELO6BrwXO6TZoORdCS5RdRUbTp3e61CDcpmZkFxD4kIqQ8S9TWxK8svMcT fu8L6d3/rcnokEnoJ+yG8tsPVDf9NAQczlzYH9Yzz3Vv/yCTPLIg0dnWEFBVuaX/qI+D ovUThW6qb4Zuw4FzOvk111S0R4dBTpL9M8hU9oRv7I3S18hxx81gphPLM0GvpbP5EG5J UM8e2EudcGCHnAFdS/jMOg1M+jZe+qekEdH1hfMi6dIrPcCZ5LALqYUW/z36pw1bpJpX 3SRxAGC+kJlnKEZfyMv7yuC0Y585p8lJHBMREzRD2FZeWwenNa24Haj51ATpfT4h3M3I GbFw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa33-20020a17090786a100b006f3b9995f9bsi4867466ejc.448.2022.05.11.20.18.17; Wed, 11 May 2022 20:18:45 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344894AbiEKQlh (ORCPT + 99 others); Wed, 11 May 2022 12:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344888AbiEKQld (ORCPT ); Wed, 11 May 2022 12:41:33 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1E97746B1E; Wed, 11 May 2022 09:41:31 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3C4AAED1; Wed, 11 May 2022 09:41:31 -0700 (PDT) Received: from lpieralisi (unknown [10.57.1.148]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 682E63F73D; Wed, 11 May 2022 09:41:29 -0700 (PDT) Date: Wed, 11 May 2022 17:41:25 +0100 From: Lorenzo Pieralisi To: Rob Herring Cc: Luca Ceresoli , Saravana Kannan , PCI , Dan Carpenter , linux-omap , linux-arm-kernel , "linux-kernel@vger.kernel.org" , Kishon Vijay Abraham I , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , Sekhar Nori Subject: Re: [PATCH 1/2] PCI: dra7xx: Fix link removal on probe error Message-ID: References: <20211214221450.589884-1-luca@lucaceresoli.net> <59a23c89-0810-eb28-acd9-7051ac34d438@lucaceresoli.net> <4579940c-27dc-733e-4022-ebea4671c839@lucaceresoli.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 Sat, Jan 15, 2022 at 10:02:00AM -0600, Rob Herring wrote: > +Saravana > > On Tue, Jan 11, 2022 at 4:35 AM Luca Ceresoli wrote: > > > > Hi Rob, > > > > On 16/12/21 10:08, Luca Ceresoli wrote: > > > Hi Rob, > > > > > > thanks for the quick feedback! > > > > > > On 14/12/21 23:42, Rob Herring wrote: > > >> On Tue, Dec 14, 2021 at 4:15 PM Luca Ceresoli wrote: > > >>> > > >>> If a devm_phy_get() calls fails with phy_count==N (N > 0), then N links > > >>> have already been added by device_link_add() and won't be deleted by > > >>> device_link_del() because the code calls 'return' and not 'goto err_link'. > > >>> > > >>> Fix in a very simple way by doing all the devm_phy_get() calls before all > > >>> the device_link_add() calls. > > >>> > > >>> Fixes: 7a4db656a635 ("PCI: dra7xx: Create functional dependency between PCIe and PHY") > > >>> Signed-off-by: Luca Ceresoli > > >>> --- > > >>> drivers/pci/controller/dwc/pci-dra7xx.c | 2 ++ > > >>> 1 file changed, 2 insertions(+) > > >>> > > >>> diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c > > >>> index f7f1490e7beb..2ccc53869e13 100644 > > >>> --- a/drivers/pci/controller/dwc/pci-dra7xx.c > > >>> +++ b/drivers/pci/controller/dwc/pci-dra7xx.c > > >>> @@ -757,7 +757,9 @@ static int dra7xx_pcie_probe(struct platform_device *pdev) > > >>> phy[i] = devm_phy_get(dev, name); > > >>> if (IS_ERR(phy[i])) > > >>> return PTR_ERR(phy[i]); > > >>> + } > > >>> > > >>> + for (i = 0; i < phy_count; i++) { > > >>> link[i] = device_link_add(dev, &phy[i]->dev, DL_FLAG_STATELESS); > > >> > > >> I think this should happen automatically now with fw_devlink being > > >> enabled by default. Can you try? > > > > > > Do you mean removal should be done automatically? I think they are not > > > due to the DL_FLAG_STATELESS flag. > > > > I would love to have feedback because, as said, I think my patch is > > correct, but if I'm wrong (which might well be) I have to drop patch 1 > > and rewrite patch 2 in a slightly more complex form. > > I mean that why do you need explicit dependency tracking here when > dependencies on a PHY should happen automatically now. IOW, what is > special about this driver and dependency? Any update on this patch ? I think patch 2 can be merged, please let me know if this one can be dropped. Thanks, Lorenzo