From mboxrd@z Thu Jan 1 00:00:00 1970 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 37AC1C433EF for ; Tue, 11 Jan 2022 10:35:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349311AbiAKKfy (ORCPT ); Tue, 11 Jan 2022 05:35:54 -0500 Received: from hostingweb31-40.netsons.net ([89.40.174.40]:47234 "EHLO hostingweb31-40.netsons.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349296AbiAKKfw (ORCPT ); Tue, 11 Jan 2022 05:35:52 -0500 Received: from [77.244.183.192] (port=64540 helo=[192.168.178.41]) by hostingweb31.netsons.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1n7EVK-000DqX-8N; Tue, 11 Jan 2022 11:35:50 +0100 Subject: Re: [PATCH 1/2] PCI: dra7xx: Fix link removal on probe error From: Luca Ceresoli To: Rob Herring Cc: PCI , Dan Carpenter , linux-omap , linux-arm-kernel , "linux-kernel@vger.kernel.org" , Kishon Vijay Abraham I , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Bjorn Helgaas , Sekhar Nori References: <20211214221450.589884-1-luca@lucaceresoli.net> <59a23c89-0810-eb28-acd9-7051ac34d438@lucaceresoli.net> Message-ID: <4579940c-27dc-733e-4022-ebea4671c839@lucaceresoli.net> Date: Tue, 11 Jan 2022 11:35:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <59a23c89-0810-eb28-acd9-7051ac34d438@lucaceresoli.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hostingweb31.netsons.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lucaceresoli.net X-Get-Message-Sender-Via: hostingweb31.netsons.net: authenticated_id: luca@lucaceresoli.net X-Authenticated-Sender: hostingweb31.netsons.net: luca@lucaceresoli.net X-Source: X-Source-Args: X-Source-Dir: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. About your request to try: I only have hardware with phy_count==1, and anyway I cannot access it at the moment. :( Regards. -- Luca From mboxrd@z Thu Jan 1 00:00:00 1970 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 F0F65C433EF for ; Tue, 11 Jan 2022 10:37:11 +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:In-Reply-To:MIME-Version:Date: Message-ID:References:Cc:To:From:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=5NR5vyhzlELqHBpYDornXc9NKh+zkoqgXn7Zgcl15jw=; b=R4CIKmVtz4h9HsFwAiN90qqU6c NvnNiYZiLmP6Gp7uK5Ee1VhkANQKTbi2+sK4QVJLrH6lCAq2bu9eqhUezienKD5/WcLvO+50czsK6 cOEgAWR6GHxYvnH3DFTpQgbF7ITXbqE7Uja0+LQEAxXkRrwnW+nuxGc31uKdvDXNx8hzXm9Nxm8Ve RNsKOkDdQ3/VFYAvwXsJsl1+0+8gdpavP2NUNFhzThf6DQdbj4EVxqeZEE3eN5NBZsL5kXGh8azb/ dHDkaNp6bFOxAiRz1vCPlubEyVp1yqsOiGN9RQ4KEcS+ysCrV8atPbnlvsQ0XbbEvmj2xeK95U/in gIxSnnYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7EVW-00FnTn-Cb; Tue, 11 Jan 2022 10:36:02 +0000 Received: from hostingweb31-40.netsons.net ([89.40.174.40]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7EVM-00FnP3-Ny for linux-arm-kernel@lists.infradead.org; Tue, 11 Jan 2022 10:35:54 +0000 Received: from [77.244.183.192] (port=64540 helo=[192.168.178.41]) by hostingweb31.netsons.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1n7EVK-000DqX-8N; Tue, 11 Jan 2022 11:35:50 +0100 Subject: Re: [PATCH 1/2] PCI: dra7xx: Fix link removal on probe error From: Luca Ceresoli To: Rob Herring Cc: PCI , Dan Carpenter , linux-omap , linux-arm-kernel , "linux-kernel@vger.kernel.org" , Kishon Vijay Abraham I , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Bjorn Helgaas , Sekhar Nori References: <20211214221450.589884-1-luca@lucaceresoli.net> <59a23c89-0810-eb28-acd9-7051ac34d438@lucaceresoli.net> Message-ID: <4579940c-27dc-733e-4022-ebea4671c839@lucaceresoli.net> Date: Tue, 11 Jan 2022 11:35:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <59a23c89-0810-eb28-acd9-7051ac34d438@lucaceresoli.net> Content-Language: en-US X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hostingweb31.netsons.net X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lucaceresoli.net X-Get-Message-Sender-Via: hostingweb31.netsons.net: authenticated_id: luca@lucaceresoli.net X-Authenticated-Sender: hostingweb31.netsons.net: luca@lucaceresoli.net X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220111_023552_984657_6D66B8C4 X-CRM114-Status: GOOD ( 19.16 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. About your request to try: I only have hardware with phy_count==1, and anyway I cannot access it at the moment. :( Regards. -- Luca _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel