Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3769155pxb; Mon, 21 Feb 2022 05:28:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxP83PYm9vBdtIXkYSUov4JmwVXnLLziXgTmFe3Tqztc1aUmsgPUvPaMkyeYk+gMRm2Rqz8 X-Received: by 2002:a17:90b:2345:b0:1bc:4273:b194 with SMTP id ms5-20020a17090b234500b001bc4273b194mr4229588pjb.108.1645450082050; Mon, 21 Feb 2022 05:28:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645450082; cv=none; d=google.com; s=arc-20160816; b=xQ+WEPu10NMLCP69bY2fRlE5BOSXjz1PSAJM9NgdkdyJom0Ak5aOyYsve7mePF9x8i TW5A0p7G2/DyiUx/MG6KxdKJENr5jWUcfoefz7Lm6xYCGYOygZkOGWqeQQNJJhejI4So YeXO80UpH3NEXpxRcPfEEy6gAHiMn0QtLO5OmyW+QRg+wI9/nyxIMiD4GsM5DCo6BXcc tg3WZjwxMbEplVCtqpfDkcUjJXaflS4vktt2i4oA+p/pWLRxVilOno0JyD4MPnW4lBa/ qqxwcEMpipNSAHAhCiti69cK8LUmN/cNF8ujq8mY/poq0CEALIEVF4kh1bMC/pK/oA7L 8f4A== 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:dkim-signature; bh=ml2gqauoTFG3Smq6lcK3ePS4/koYLjxr1U+WiMKY3+Q=; b=h0VtXS/B5b/Aa77xjwY4l7o7dwNwjfDK5epGzM+e6h0YL4PCXHR6SLywY8BpqWCkkF WEqEUHrKr3+7Lwjm0GzaUUe7by7Ucsmu10tQGBJWyGxm28woCHjDck5Q8WkvJbsZGybq xHjA4kBlE3xLGRq4KBtETkNTObCOHStCrBHH2cwwmg0znqU1Mkxk3766yeLbHhSh2CbG IgdZkvSu/yYI3DhsC/yYeXQbihqVicl1SFivCLpi90Vbt/i614UqAg7F/onUrsgLZ37B r08MxqaZz98ado07eKwB+T5sgc7yCv+p6gRcTxsYtHn5lDNDTzpbhzm2SdolyV4D34ir z+vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=ya3MgtNt; 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 b9si30758006pll.340.2022.02.21.05.27.45; Mon, 21 Feb 2022 05:28:01 -0800 (PST) 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=pass header.i=@lunn.ch header.s=20171124 header.b=ya3MgtNt; 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 S1358424AbiBUM6r (ORCPT + 99 others); Mon, 21 Feb 2022 07:58:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231617AbiBUM6o (ORCPT ); Mon, 21 Feb 2022 07:58:44 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EEBF1EAD4; Mon, 21 Feb 2022 04:58:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=ml2gqauoTFG3Smq6lcK3ePS4/koYLjxr1U+WiMKY3+Q=; b=ya3MgtNtZC7scN7QPF0NlWuMzE wcAkZ9rzRI+5L2HcZ+n6cz1hTvP7m1DiLcHktw1rZ/AH2Wat58o4b3Y8W5iTvm24KjKsVcbHJyaqP hQ4Te6cyjVjdv/tq+kuVIuL7tSRzOLyJukSn81B2XXBXhGBYx9Z8v0KJltr6M4Y0EscA=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nM7hN-007JrM-Dr; Mon, 21 Feb 2022 13:21:49 +0100 Date: Mon, 21 Feb 2022 13:21:49 +0100 From: Andrew Lunn To: Mauri Sandberg Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Hesselbarth , "David S. Miller" , Jakub Kicinski Subject: Re: [PATCH] net: mv643xx_eth: handle EPROBE_DEFER Message-ID: References: <20220221062441.2685-1-maukka@ext.kapsi.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220221062441.2685-1-maukka@ext.kapsi.fi> 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_PASS,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 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. Andrew