From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.smtpout.orange.fr (smtp-28.smtpout.orange.fr [80.12.242.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DC122E7BAA; Mon, 22 Sep 2025 15:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.28 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758555305; cv=none; b=QevMgnBaVBnZzSQdEKwhENtyJkGwsi66iRHdeZo0eiPMHzFylIsJ+ALMK3SEd8FIxi/hL7YgujGfmOz0hzK1zkU2qJBMva+AJ45qzFjGVRhTsFtemXE1+6stmdlC0A3m1ICYzI6ghtoHXneZamJp5SvvI/gabwMmo8Tg6Ov0kbE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758555305; c=relaxed/simple; bh=S3nR08scvOYxQPr9SDbE350r0bvaB769ACMZhiLksS8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=HpJymOuRYrlfKGLeiX6JU8tOw4fmTlN5UUwl+hRhnLWjVXdrSv618i8bX5e7fGyuzJP5uvLU4L9aI2NRSOKOmTOpPmao3eoN0xOwDdgSWpI4qyXcKmTgK2r0Yg4Cr1yg0nZXWzijzwNV3NCiX/cmJm/WdUyq0lMeB/k1V7YQVBw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=W2Fqf7K0; arc=none smtp.client-ip=80.12.242.28 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="W2Fqf7K0" Received: from [IPV6:2a01:cb10:785:b00:8347:f260:7456:7662] ([IPv6:2a01:cb10:785:b00:8347:f260:7456:7662]) by smtp.orange.fr with ESMTPA id 0iZ2vqcWnFsG90iZ2vKGzC; Mon, 22 Sep 2025 17:34:55 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1758555295; bh=3FaNLmFmhfEak/yzdIxKjy3ePRlrUJpce254WrXdU+E=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=W2Fqf7K0VzK9c4pK612dHLabrgEz35aD6e8QOKUy64xfSjBRQT/YLhKICZ2Zgh1Q2 SGx9BYA9o48DMqQbVGenaPHjHTWG+PoPdGb+HzNWY2DgMX1blgK9CSgOeKkZ+OEjH2 ZhaSlqOq/Wl7QzDPdDQkURFfgH3VJTvyKc5OzmJ59IcI/UH6pieB3TlzVlyT88ETLU sWz1qLy3vtso87yexg2chFDGromRpfjYtoAJGmuKBeB/aIsPY30vCueG0rGYvsIcDM 6VijCYYYHNNu3WKwbqWiSKL2Ls6UAS0Kt7X33gB8ewtcu2OGwqG0fM61ncPJ0tE40v fE4kPVEZqjvmA== X-ME-Helo: [IPV6:2a01:cb10:785:b00:8347:f260:7456:7662] X-ME-Auth: bWFyaW9uLmphaWxsZXRAd2FuYWRvby5mcg== X-ME-Date: Mon, 22 Sep 2025 17:34:55 +0200 X-ME-IP: 2a01:cb10:785:b00:8347:f260:7456:7662 Message-ID: <233f751e-b7f3-452f-a9ac-9c88621badb4@wanadoo.fr> Date: Mon, 22 Sep 2025 17:34:52 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v1] net: mv643xx_eth: Fix an error handling path in mv643xx_eth_probe() To: Andrew Lunn Cc: Sebastian Hesselbarth , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lennert Buytenhek , Andy Fleming , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, netdev@vger.kernel.org References: From: Christophe JAILLET Content-Language: en-US, fr-FR In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 >> --- >> 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 > 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