๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17404

Re: [PATCH net-next v2] net: phy: et1011c: don't write an error code to the config register

#17404
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 18:59
70 lines
10240 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] net: phy: et1011c: premature speed update in
  et1011c_read_status()

--

> diff --git a/drivers/net/phy/et1011c.c b/drivers/net/phy/et1011c.c
> --- a/drivers/net/phy/et1011c.c
> +++ b/drivers/net/phy/et1011c.c
> @@ -62,16 +62,22 @@ static int et1011c_read_status(struct phy_device *phydev)
>  {
>  	static int speed;
>  	int ret;
> -	u32 val;
> +	int val;
>  
>  	ret = genphy_read_status(phydev);
>  
>  	if (speed != phydev->speed) {
>  		speed = phydev->speed;
>  		val = phy_read(phydev, ET1011C_STATUS_REG);
> +		if (val < 0)
> +			return val;
> +
>  		if ((val & ET1011C_SPEED_MASK) ==
>  					ET1011C_GIGABIT_SPEED) {
>  			val = phy_read(phydev, ET1011C_CONFIG_REG);
> +			if (val < 0)
> +				return val;
> +
>  			val &= ~ET1011C_TX_FIFO_MASK;
>  			phy_write(phydev, ET1011C_CONFIG_REG, val |
>  					  ET1011C_GMII_INTERFACE |
>
>

[Severity: Medium]
With the new early returns, et1011c_read_status() updates the static
speed cache to phydev->speed before either phy_read() is attempted.

Suppose the read of ET1011C_STATUS_REG or ET1011C_CONFIG_REG fails
while the link comes up at 1000Mbps. We return the error without
programming ET1011C_CONFIG_REG, but speed already equals
phydev->speed. On the next poll the speed != phydev->speed test is
false, so the block is skipped. ET1011C_GMII_INTERFACE,
ET1011C_SYS_CLK_EN and ET1011C_TX_FIFO_DEPTH_16 are then never applied
for that gigabit link.

The error path in _phy_state_machine() does not help either. Entering
PHY_ERROR clears phydev->link but leaves phydev->speed alone, so a link
that comes back at the same speed will not retrigger the write.

Could speed be updated only after the reads (and ideally the
phy_write()) have succeeded, so that a transient MDIO error is retried
on the next poll? Or is there a reason the cache has to be set before
the register accesses?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261115180735.649299-1-elias.pukari%40gmail.com
Technical Details
Message-ID: <179485554872.3136.2853572906945647083@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364646-linux-kernel-netdev=dewy.ru
References: <20261115180735.649299-1-elias.pukari@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364646-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2] net: phy: et1011c: don't write an error code
 to the config register
Date: Mon, 16 Nov 2026 18:59:08 +0000
Organization: Usenet Network
Message-ID: <179485554872.3136.2853572906945647083@kernel.org>
References: <20261115180735.649299-1-elias.pukari@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2143490"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:D7TtDeNpCSL462OiUUNFzlsBzNs= sha256:KnFMUsN04ClDIB/W0Al3Tn4pUCLcQumWZ6vA2sGjYtI=
	sha1:DaJCLf0oqap3ETz+L/xSAFPRTMg= sha256:JVHFHu7D96g8IjG8KCGSTNIgxMAnmEwOdw7/Z022CIs=
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 F34F2114D3C; Mon, 16 Nov 2026 22:00:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 GEog3WIC4VDg;
	Mon, 16 Nov 2026 22:00:01 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364646-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 ABEDC114D2C; Mon, 16 Nov 2026 21:59:51 +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 2866E30985; Mon, 16 Nov 2026 18:59:16 +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=1794855556;
	b=OqmycEuCQv8A4+fxXG6nhViPzANlxe3wjKkq2IATxF7yA+uB8Nj0+KGXKhBWQhU1dB3X
	 VNnXSwimEiIx19eCXi3nDplWPLvOdSFTltF+H+FMHvmxDKbw3fvho0qs5FiaqqJxHzoJO
	 ByjrhyWxDVmfQlimlpCaTfJGWMDaDFizKJ5HSZ1noj80iOgdBbm526pzj7irgJGHeDQUl
	 VZOngvDlczLAlL3OFsayQkau1fxfbFUvQ6DHVb1uH+816GLTuC10GbLGrhUDqtO8nqVyF
	 +1gpT8d74Rmanme/Ct5IAEV/He7nAUJYH2+gfbuFvjLO61bpIrT4XPKRfzHrV4jS6VA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794855556;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=OKuapl7pxJVZ9ih+JjiApVj2U7or+RT35W4g1hlcqf4=;
	b=4dgPZnJWqiAENiWbtHp9bHp9l8sa1WH1qU9jegiKZPIgk7KmL/Lt6ODOj9ku8mnRHNI9
	 qDz4H/pLBA7Eqo61/TPNAmMbHTs0SuSa323zXUBYQUf2RXFuiAeKpAEd5H8UfytHDIOH3
	 E3Axr7wTki2YN0qEVqS0b+hDe5RskJlWhu2C7Aby0CQPC2DxFg9BUw5e2naXM0t257FlU
	 nymXz8dnJYaUA8gTWNHae1ZvqB5e5B0ZnX4XPvBjNVUZCKPGp7Tzzlb3Su5/4OPvNjxFs
	 DWxSwp0uvJVEH0m9hIBUm7xwpJPtPfEi7C9OsVRDS0AgJss+oOm/W2URU7ScoMXAIBg==
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=aazqUdLt;
	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 F3F23606A31C;
	Mon, 16 Nov 2026 18:59:15 +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=aazqUdLt
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=1794855550;
	b=5dgqBejXMgybbQK7p7CwfJJ7mPv0FBf7XeQ0m0FLKezn0Dk214WMGB1A6dtIJtBXslQt
	 FyQXiBErcWfxa0MsFpcMJ0aGv4J599dU/6Iy6GqQSiafF77ZVKmuYNgl8XNWfnzP1mw7A
	 V+nCje+YGlcv13sK7SZrQTJcLJSK4tC+EUI9rw5EREwdETsRBJ+INN5Ks2NljqzMVYwvC
	 nZjsKvrvl9rAoFZx3The8LyF/XuAF/useI8sVYmpntKQQukpZ14abXUxKxKMlPWnZzUWh
	 RE7FCu9Iri7LZohoNs94NYZsvT3icw5nWqIWYAzWnF8xKpm4neTLj9+CbZdorp6M6Ew==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794855550;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=OKuapl7pxJVZ9ih+JjiApVj2U7or+RT35W4g1hlcqf4=;
	b=gNev/t58sktR6dfr9t8zcYxtG47dqKhwBqIas5SXytV6Ir1c5R8+tw64eI1CwFzdKcdB
	 3VoHhKfdHWvodulUB03jGuZI5GTcpwk2otiL938m+DVlLmkr0iFv/xFNFh0QNW24q+UnG
	 qz1bbiq4ZoEFxMPiWrDQQ93DVJru6MahHotdPuNVyKqxKKZtllw0lV6BJ2qTtgeW8jAyT
	 9ye59JQlFCVNAnaQzZMbYEFCslkCOpqeEtllpQd2u8XQH1bTaSSpbvSjrWjm9ZqC6At3A
	 2ncyHnvthc3wiB6TQPSksYaYl48szuiSW1Nh8Vt0jaNMdjGOkH/zVbIwvdYi27YLewQ==
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=aazqUdLt;
	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 0D34A606A89E;
	Mon, 16 Nov 2026 18:59:09 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3021C1F000C9;
	Mon, 16 Nov 2026 18:59:09 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794855549;
	bh=OKuapl7pxJVZ9ih+JjiApVj2U7or+RT35W4g1hlcqf4=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=aazqUdLtYeeamJwl1hwJYAF96pgNZdf29ZdAH5YIP0MGUjVRx2E2PYVPS4ZirF9bj
	 ZVPGFwVY9QVLhIpgRpQPZILtqVOeyRf2vTuf4VJeN3gUoFYfs6J5ikmIp3DQvqndtJ
	 FlrcazoE9bRylOGIVzpC2vV2QjNV5Lsk75Kua+ml2tzjKFqZl+RsmWvIyG6B0pFlC2
	 8j9jqQ5FQPU2/FSBgfFhxt2BtySd9GcVwWfttaUyf3s5EI5f4AK+SGy1oemDqlD3VL
	 NEKRiGWvHqxvl5ZSjS/TApYUQ1adEtkRopl6/nmPerI/b+TUrtJkxPJHya1rk+XHFQ
	 OghLHd5UQpxWQ==
X-Cc: netdev@vger.kernel.org, andrew@lunn.ch, hkallweit1@gmail.com,
 linux@armlinux.org.uk, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261115180735.649299-1-elias.pukari@gmail.com>
X-sashiko-severity: Medium
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