X-Received: by 2002:a17:90b:2496:b0:1b9:a6dd:ae7 with SMTP id nt22-20020a17090b249600b001b9a6dd0ae7mr2493832pjb.35.1645509266977; Mon, 21 Feb 2022 21:54:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645509266; cv=none; d=google.com; s=arc-20160816; b=Uzp/cJdikaZW20CW3BDyOnPqFhk2X/z59apZJmC7129SXlfEdk3OFyDndu98JymAPR sS+gqXtoVXjLpXGPLbep7HouedLUlr2ISQNHy2vpIcKAEpUODUv/VUeOmCLCdiJPx57w 0fbgCuohpX+I1E4RMnoMsxAe09NP50Gu8Lr+m7Ha26YdpNHHkoIdO7gb5d9aNwkrSmce 86rx+70+voWSJKuJBwz4Rq2Re8n0RX782uY0n2vDynXqkvNum5FRZRvJWXH7LFXyNLgZ 4oUfjlIKe+HpnIXye1uEbP/CLzgp8JEc/6Y3/2MfAj1MNYn0IY8Xk/KAA1b6hiZgp1w7 TRBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:in-reply-to :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=Seqw0zUcjmCmt2PCKp9l6scFXw8yrx43pqaz3xR+wNg=; b=v0nYFzi2FwhQXqbQeOLLGLkd3Ifbadcha3/wI3RTCimy2GjzcFjwnSxuldLlr72spe SzQHZllpMO4PxbYfz9Eg72xXQL64sVyQ+d9jkQcxK420IaawxEzzSihQ5ZJzLQ5H8OsO Dwn2gU/XJy8nLdm4IVfzqWecp3FN8go2V/HXHBUOkBXkk57wReQMyitgxbSeEDRo8KOe Gvyt+js58f70oIDqmRauc3kmO6T0wQXwW/wcB2Z7REU7skZ0r+3E7px9gZ8XoIwF8FMb Y01GJ5m0niQ5mdJB4YHRbIf4DWMkRfxvDCclEGRLk873/J47E8DCrlM72a1jZokbBwKv OF8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ext.kapsi.fi header.s=20161220 header.b=Rvml0oZl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z7-20020a17090abd8700b001bc72f11773si602603pjr.170.2022.02.21.21.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:54:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=fail header.i=@ext.kapsi.fi header.s=20161220 header.b=Rvml0oZl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7D9B7FABFC; Mon, 21 Feb 2022 21:17:07 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231379AbiBUS1w (ORCPT + 99 others); Mon, 21 Feb 2022 13:27:52 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233419AbiBUS0O (ORCPT ); Mon, 21 Feb 2022 13:26:14 -0500 Received: from mailserv1.kapsi.fi (mailserv1.kapsi.fi [IPv6:2001:67c:1be8::25:1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74A15C7F; Mon, 21 Feb 2022 10:25:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ext.kapsi.fi; s=20161220; h=Subject:Content-Transfer-Encoding:Content-Type: In-Reply-To:From:References:Cc:To:MIME-Version:Date:Message-ID:Sender: Reply-To: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=Seqw0zUcjmCmt2PCKp9l6scFXw8yrx43pqaz3xR+wNg=; b=Rvml0oZlH1IiF0bNfoYSutVSlG PXTBs92aGdAvMPiIHmUib/17nNihx6GIHgxBeSGR1KGQkcnE0z2JXnn4oiCFZHimDA6j7Dk306jAf B5cB1TEYmtuVdBJHMUZquFbNh9O7l6Tm+5MWzTOYfySK12HdUEYNE2GL9dQG8g1ty4JVD9W0WwDLO SalcxEPSfnw0711rJmu4cbqYNQQAeoZmhTm08+6c9K5TUPqvYknw6zP34AYGEoJXrU9Z+hQLtUv68 1hZPKuGoCKfkdGYe99dHWJBPcZImLYuwTMwq5sRsQo9u7+aA8DmK5mWto+HI6ps4TyVivJcOrc7Fa ZolnBArw==; Received: from 15-28-196-88.dyn.estpak.ee ([88.196.28.15]:54283 helo=[10.0.2.15]) by mailserv1.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1nMDMx-00029k-PM; Mon, 21 Feb 2022 20:25:08 +0200 Message-ID: <72041ee7-a618-85d0-4687-76dae2b04bbc@ext.kapsi.fi> Date: Mon, 21 Feb 2022 20:25:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Content-Language: en-US To: Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Hesselbarth , "David S. Miller" , Jakub Kicinski References: <20220221062441.2685-1-maukka@ext.kapsi.fi> From: Mauri Sandberg In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 88.196.28.15 X-SA-Exim-Mail-From: maukka@ext.kapsi.fi X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 Subject: Re: [PATCH] net: mv643xx_eth: handle EPROBE_DEFER X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mailserv1.kapsi.fi) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Andrew, On 21.02.22 14:21, Andrew Lunn wrote: > On Mon, Feb 21, 2022 at 08:24:41AM +0200, Mauri Sandberg wrote: >> Obtaining MAC address may be deferred in cases when the MAC is stored >> in NVMEM block and it may now be ready upon the first retrieval attempt >> returing EPROBE_DEFER. Handle it here and leave logic otherwise as it >> was. >> >> Signed-off-by: Mauri Sandberg >> --- >> drivers/net/ethernet/marvell/mv643xx_eth.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c >> index 105247582684..0694f53981f2 100644 >> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c >> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c >> @@ -2740,7 +2740,10 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev, >> return -EINVAL; >> } >> >> - of_get_mac_address(pnp, ppd.mac_addr); >> + ret = of_get_mac_address(pnp, ppd.mac_addr); >> + >> + if (ret == -EPROBE_DEFER) >> + return ret; > Hi Mauri > > There appears to be a follow on issue. There can be multiple ports. So > it could be the first port does not use a MAC address from the NVMEM, > but the second one does. The first time in > mv643xx_eth_shared_of_add_port() is successful and a platform device > is added. The second port can then fail with -EPROBE_DEFER. That > causes the probe to fail, but the platform device will not be > removed. The next time the driver is probed, it will add a second > platform device for the first port, causing bad things to happen. > > Please can you add code to remove the platform device when the probe > fails. I am looking at the vector 'port_platdev' that holds pointers to already initialised ports. There is this mv643xx_eth_shared_of_remove(), which probably could be utilised to remove them. Should I remove the platform devices only in case of probe defer or always if probe fails?