From: Andrew Lunn <andrew@lunn.ch>
To: Mauri Sandberg <maukka@ext.kapsi.fi>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH] net: mv643xx_eth: handle EPROBE_DEFER
Date: Mon, 21 Feb 2022 13:21:49 +0100 [thread overview]
Message-ID: <YhOD3eCm8mYHJ1HF@lunn.ch> (raw)
In-Reply-To: <20220221062441.2685-1-maukka@ext.kapsi.fi>
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 <maukka@ext.kapsi.fi>
> ---
> 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
next prev parent reply other threads:[~2022-02-21 12:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 6:24 [PATCH] net: mv643xx_eth: handle EPROBE_DEFER Mauri Sandberg
2022-02-21 12:21 ` Andrew Lunn [this message]
2022-02-21 18:25 ` Mauri Sandberg
2022-02-21 22:15 ` Andrew Lunn
2022-02-22 5:42 ` Mauri Sandberg
2022-02-23 14:23 ` [PATCH v2] net: mv643xx_eth: process retval from of_get_mac_address Mauri Sandberg
2022-02-24 16:57 ` Jakub Kicinski
2022-02-24 17:43 ` Andrew Lunn
2022-02-24 18:20 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YhOD3eCm8mYHJ1HF@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maukka@ext.kapsi.fi \
--cc=netdev@vger.kernel.org \
--cc=sebastian.hesselbarth@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox