From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Lennert Buytenhek <buytenh@wantstofly.org>,
Andy Fleming <afleming@freescale.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH net v1] net: mv643xx_eth: Fix an error handling path in mv643xx_eth_probe()
Date: Mon, 22 Sep 2025 17:34:52 +0200 [thread overview]
Message-ID: <233f751e-b7f3-452f-a9ac-9c88621badb4@wanadoo.fr> (raw)
In-Reply-To: <efff779e-96e1-473a-8b9c-114b090ff02c@lunn.ch>
Le 22/09/2025 à 14:53, Andrew Lunn a écrit :
> On Mon, Sep 22, 2025 at 10:08:28AM +0200, Christophe JAILLET wrote:
>> If an error occurs after calling phy_connect_direct(), phy_disconnect()
>> should be called, as already done in the remove function.
>>
>> Fixes: ed94493fb38a ("mv643xx_eth: convert to phylib")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> This patch is speculative and compile tested only.
>> Review with care.
>> ---
>> drivers/net/ethernet/marvell/mv643xx_eth.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
>> index 0ab52c57c648..de6a683d7afc 100644
>> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
>> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
>> @@ -3263,6 +3263,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
>> return 0;
>>
>> out:
>> + if (dev->phydev)
>> + phy_disconnect(dev->phydev);
>
> This is correct, but it is a little bit less obviously correct than it
> could be. Nothing in mv643xx_eth_probe sets dev->phydev. It happens
> deep down in the call chain of of_phy_connect(). Just using:
>
> if (phydev)
> phy_disconnect(phydev);
>
> would be more obvious for this probe function.
>
> But since it is correct, Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> and i will leave you to decide if you want to change it.
>
> Andrew
>
>
In the (pd->phy_addr != MV643XX_ETH_PHY_NONE) case, phydev could be an
error code.
So, we should do something like:
if (!IS_ERR_OR_NULL(phydev))
phy_disconnect(phydev);
Agree?
CJ
prev parent reply other threads:[~2025-09-22 15:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 8:08 Christophe JAILLET
2025-09-22 12:53 ` Andrew Lunn
2025-09-22 15:34 ` Christophe JAILLET [this message]
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=233f751e-b7f3-452f-a9ac-9c88621badb4@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=afleming@freescale.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=buytenh@wantstofly.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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
all inboxes | Powered by JetHome®