Article View: linux.kernel.netdev
Article #13309Re: [PATCH] net: lan743x: disconnect the PHY when PTP setup fails
From: Simon Horman
Date: Mon, 09 Nov 2026 16:37
Date: Mon, 09 Nov 2026 16:37
57 lines
9824 bytes
9824 bytes
On Tue, Nov 03, 2026 at 10:28:52AM +0000, Wentao Liang wrote:
> lan743x_netdev_open() connects the PHY before opening PTP, but if
> lan743x_ptp_open() fails it jumps to close_mac, which skips
> lan743x_phylink_disconnect(). The reference taken by
> phylink_connect_phy() is then never released, and the PHY stays
> attached to the phylink instance.
>
> Add a close_phylink label in front of the phylink disconnect, as the
> pre-phylink conversion code did with close_phy, and use it on the
> lan743x_ptp_open() failure path.
>
> Fixes: a5f199a8d8a0 ("net: lan743x: Migrate phylib to phylink")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/net/ethernet/microchip/lan743x_main.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
> index 82d3ec20ba25..390aec639c71 100644
> --- a/drivers/net/ethernet/microchip/lan743x_main.c
> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> @@ -3331,7 +3331,7 @@ static int lan743x_netdev_open(struct net_device *netdev)
>
> ret = lan743x_ptp_open(adapter);
> if (ret)
> - goto close_mac;
> + goto close_phylink;
>
> lan743x_rfe_open(adapter);
>
> @@ -3374,6 +3374,8 @@ static int lan743x_netdev_open(struct net_device *netdev)
> lan743x_rx_close(&adapter->rx[index]);
> }
> lan743x_ptp_close(adapter);
> +
> +close_phylink:
It seems odd that basically this unwind logic existed before the
cited patch - even if the internals of the unwind differed - but
was removed by it. And yet, the unwind happens for other cases.
> if (adapter->phylink)
As an aside, I don't believe adapter->phylink can ever be NULL here.
> lan743x_phylink_disconnect(adapter);
Please do answer the email from netdev-bot+sinfo requesting,
elsewhere in this email thread, information about the providence of
this patch.
The above not withstanding, this looks good to me.
Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID:
<20261109163715.GQ18859@horms.kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359442-linux-kernel-netdev=dewy.ruReferences:
<20261103102852.1340530-1-vulab@iscas.ac.cn>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359442-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] net: lan743x: disconnect the PHY when PTP setup fails Date: Mon, 9 Nov 2026 16:37:15 +0000 Organization: Usenet Network Message-ID: <20261109163715.GQ18859@horms.kernel.org> References: <20261103102852.1340530-1-vulab@iscas.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="403948"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:D/KD1ZOk4zRoIYqkWCKC9twYcsA= sha256:AtoeoBhsXlUAiTkHX2qhHybusXHxwfcwFIPRCsNUjeI= sha1:+vIK//IqFGSGSM6mOTCw4JrPRUk= sha256:1dy0uFrNsxS+0Ytmv4/SxI8F88eLrcEbo+YTE10+bEQ= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 6AF2B11388D; Mon, 9 Nov 2026 19:49:49 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FqXb1hTh555q; Mon, 9 Nov 2026 19:49:42 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-359442-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 557BE11378E; Mon, 9 Nov 2026 19:49:30 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 8B27E3B479; Mon, 9 Nov 2026 16:39:27 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794242241; b=WySMpMsBmmgC6x7ihTW4XJizGcFmzpDl7Mr4RPQMYnoMtU5+Zbci7aEGNd2rGGhgkvwV Qp04iUpz3hVLnI7qevtFcAkBPc3ys7/494kcI5dzRv2quIhTDe4EO5MSIilD/EjQk6j98 uQ/Kii7w0ie+4Wx91C+Q52IR/0BwDde/D6z2QId3GC/T9gVOh5/sf7jJ6vZClsPkGEBK6 BGB+IIufx9zepLE1v71GNdGlN/vqQPRelFlP8Rqq8i7qkscDpfxU6iZLG78AgMRAYyCr2 aTsRiVVPMrgeyVx/DhAhIZpt96avVUPWV4yPJ6ue90iYuTKBhSickb2BvwgQ4FFweSA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794242241; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=eaeDip5yy0FF8SCIX/1UWm1Ikp0/r1QeQQKcFD3VElY=; b=XCTOo6fT0pCkOtr8H2IRraqL2klRlzTUhS5ONMG/EHPYQtiAfKsHV/KTPVmZK/5S5C4L CbtooO1wNsO50o1q/Z7YrfDuEfi69ENV3MolNBfjooVSysEbBqJR2/Gl1Q8hL33f/yV6f kD71B2S+LqrfG8V0uP8tKd8yBy3KXGWgMQfLkGmCMRuy7ALEJIApKumZOBIYrgd6lgYFy Mly8wTD/YYcKWQZV49J8SIZ+adCAc7FeCDOF+x+Ere31zTGCkS+xOF3gZd0pcYLAi+7ww SNRX5wVZo700BSYued95xRkxModLy14v2aFgBINspqYoBoUZLCyQFEPWkR6XYaPndyA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="d/WYzf4E"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FA1F606C735; Mon, 9 Nov 2026 16:37:21 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=d/WYzf4E X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794242240; b=CIaTH8nc8iP1BXmAlcGIgxO9avz/HG0y+i4OEk5sD1z//a+BQaNIX+tn2LdhfUcG/iVJ yrIBoXV6ZHcQLYvl0hGwzQ+qXjfC3YbJas0OcqtpYNsjkV+RAzfZM7kLA2F/sucYcJ3lq uA2tHeRuVPU8L5FERgT+Ptj9Qd+BThWJZ8qr552NBiQn9qibxgNZRraGXz9hsBsFYLDRa oalLGeMWdGgKp/3Z5mWC8gePgvqqd6B3Le1qyIvSSrR8ctq5pcWKclu9A3x+J2qSYsx01 1B2NR+p8t0sKcnZ8O5qdltqaNoVLNyms9ZttuCAc5nTm9hg7814EnHuCPfc5sozu92g== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794242240; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=eaeDip5yy0FF8SCIX/1UWm1Ikp0/r1QeQQKcFD3VElY=; b=ZPVOtQt0Hxe6dNKCCGOXJ+BB8v3hH041Jxdyymzer++tZ2ZAXtOdAGHRTiI0BL+HpoWP LBpVaq/qTRS7s42Vq8qg08M8XsJRHpdbI+PTtOddMnxmXkK9PYO+TgDW0oB2QVedovzZa T0g8vPjB/3JmRXgIsq20Bslnx1bCrSXUjStSe/nhg8H8S56XE5oM5WYxpkq4T73Xd2kqa mZwL5J9WuC1oVHw+Zzp21Ell9+hIovhbAu4nFWUuY0Td+pSZAz//kTIdskpbVss4CAlXT r8Ms73h4xtoNLwEzHQG+F4ow+m8NIahpN4ZtN34YIof/XLrlZLr83/pj3aIvx/mD7VQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="d/WYzf4E"; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84137606C730; Mon, 9 Nov 2026 16:37:20 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F1D81F008A4; Mon, 9 Nov 2026 16:37:17 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794242240; bh=eaeDip5yy0FF8SCIX/1UWm1Ikp0/r1QeQQKcFD3VElY=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=d/WYzf4ECjeuD/81NWrh0x5HGDdfTJrdvs93UvhC6he9Hw+cxFt/mbwwKekc+cYy0 Fvw9zDv2NbKFvaXwXvllJZtmP4Aun7/ruhTRQfb0h6KgqK9OuJKr3d50j+WezU0M1m 1obtjz6Tbfz8g1cXAQtEiY2bQfYg1t+UK6KKTRNaaA/HXWIHqOm4vmyzRyXp2TJn+N 2KrlM3QrYDe+kjQstHK2eIIY91JArp1gDe+LBRAH9TzmmvJ9CG0Tz/D/+JxSlNHKU9 aXGKAmPLKNu6d1o9O66tydi8du93kLQl9wwM8XypqjTM2Z1u81MDbz5OVuDdKI6DwX cjHo8nSqDxnuQ== X-Cc: Bryan Whitehead <bryan.whitehead@microchip.com>, UNGLinuxDriver@microchip.com, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261103102852.1340530-1-vulab@iscas.ac.cn>