🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7042

Re: [PATCH net-next v4 4/7] net: ftgmac100: Enable AST2700 RMII support

#7042
From: netdev-bot+sashiko
Date: Sat, 24 Oct 2026 12:14
125 lines
12572 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] The commit message and the new comment in ftgmac100_start_hw()
  (drivers/net/ethernet/faraday/ftgmac100.c) both say that an opened…

--

net: ftgmac100: Enable AST2700 RMII support

This patch adds a FTGMAC100_QUIRK_RMII_ENABLE match-data quirk for
AST2700. When the attached PHY uses RMII, ftgmac100_start_hw() now sets
FTGMAC100_MACCR_RMII_ENABLE. The commit message argues that
netdev->phydev is always populated by the time ftgmac100_start_hw() runs.

> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 67b1fa464a421..9b7becb017262 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c

[ ... ]

> @@ -355,6 +359,12 @@ static void ftgmac100_init_hw(struct ftgmac100 *priv)
>  static void ftgmac100_start_hw(struct ftgmac100 *priv)
>  {
>  	u32 maccr = ioread32(priv->base + FTGMAC100_OFFSET_MACCR);
> +	/*
> +	 * Only reached once the device is open, so a phy_device is already
> +	 * attached: a discrete PHY via "phy-handle", a "fixed-link" node, or
> +	 * NC-SI's internal fixed 100M PHY.
> +	 */
> +	struct phy_device *phydev = priv->netdev->phydev;

[ ... ]

> @@ -383,6 +393,11 @@ static void ftgmac100_start_hw(struct ftgmac100 *priv)
>  	if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
>  		maccr |= FTGMAC100_MACCR_RM_VLAN;
>  
> +	if ((priv->quirks & FTGMAC100_QUIRK_RMII_ENABLE) &&
> +	    phydev->interface == PHY_INTERFACE_MODE_RMII) {
> +		maccr |= FTGMAC100_MACCR_RMII_ENABLE;
> +	}

[Severity: Medium]
Can phydev be NULL here on AST2700?

The commit message says:

  ftgmac100_probe_dt() always attaches a phy_device before
  register_netdev() can succeed -- via a discrete PHY ("phy-handle"), a
  "fixed-link" node, or NC-SI's internal fixed 100Mbit PHY

ftgmac100_probe_dt() also has a fallback path. If the node has an "mdio"
child and no use-ncsi, fixed-link or phy-handle property, it returns
success without connecting a PHY:

drivers/net/ethernet/faraday/ftgmac100.c:ftgmac100_probe_dt() {
    ...
	if (!ftgmac100_has_child_node(np, "mdio")) {
		...
		err = ftgmac100_mii_probe(netdev);
		...
	}

	return 0;
}

ftgmac100_probe() then calls register_netdev() with netdev->phydev ==
NULL. The aspeed,ast2700-mac binding in faraday,ftgmac100.yaml appears to
allow this layout. phy-handle is optional, an mdio child is allowed, and
only phy-mode is required.

The rest of the driver also seems to treat phydev as optional. For
example, ftgmac100_open() does:

	if (netdev->phydev) {
		/* If we have a PHY, start polling */
		phy_start(netdev->phydev);
	}

ftgmac100_stop(), ftgmac100_reset_task(), ftgmac100_set_pauseparam() and
ftgmac100_phy_disconnect() check for NULL in the same way.

The quirk bit is always set for AST2700, so the && does not
short-circuit. With such a DT, this path would dereference a NULL phydev:

ftgmac100_open()
  ftgmac100_init_all()
    ftgmac100_start_hw()
      phydev->interface

Today the same open path oopses earlier. It hits the unguarded check in
ftgmac100_reset_and_config_mac() that the commit message cites as
precedent:

	if (priv->is_aspeed && priv->netdev->phydev->interface == PHY_INTERFACE_MODE_RMII) {

That existing check looks like a latent NULL dereference itself, so it
doesn't prove the invariant. This patch adds a second dereference, which
would become the crash point if the earlier check were fixed or
reordered.

The later patch in this series, "net: ftgmac100: Require phy-mode for
AST2700", only changes ftgmac100_mii_probe(). That function isn't called
when an mdio child exists, so the gap seems to remain at the end of the
series.

Would it make sense to check phydev && phydev->interface ==
PHY_INTERFACE_MODE_RMII here? Another option is to have probe fail when
no PHY is attached on Aspeed MACs, which would also cover
ftgmac100_reset_and_config_mac(). Either way, the new comment above the
phydev declaration and the commit message would need updating to match.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020-support_ast2700-v4-0-4d36b40939b3%40aspeedtech.com
Technical Details
Message-ID: <179284409002.3134.6819446843199664774@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351364-linux-kernel-netdev=dewy.ru
References: <20261020-support_ast2700-v4-4-4d36b40939b3@aspeedtech.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351364-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v4 4/7] net: ftgmac100: Enable AST2700 RMII support
Date: Sat, 24 Oct 2026 12:14:50 +0000
Organization: Usenet Network
Message-ID: <179284409002.3134.6819446843199664774@kernel.org>
References: <20261020-support_ast2700-v4-4-4d36b40939b3@aspeedtech.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="753489"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:VhWM94JSzSezrbdowyVVY5WNFvc= sha256:ffm9S85KagSiAjo/OR/I/6yb3qTMPUCAwYx8RbHB+6w=
	sha1:6/EvUYYGOMslAkYczz+3sfWxfms= sha256:hIBXHifoPvDRWuifg6zgGp9ZXZAgDwMDwa5ZXlOtRdA=
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 4A1BB111630; Sat, 24 Oct 2026 15:17:23 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.639
X-Spam-Status: No, score=-2.639 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339,
	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 fGkU68gfkxGa;
	Sat, 24 Oct 2026 15:17:19 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-351364-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 1FAD411162B; Sat, 24 Oct 2026 15:17:11 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id B28D72A68B; Sat, 24 Oct 2026 12:15:20 +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=1792844112;
	b=0g2NsiBfu+9LptI2nlepFNalCjDeHanTDwB7EPdPB+uG5TZEjx593fh2h3DdDDzKEUve
	 nHooFOvqP7W5d+Aq4cqmQwoTlbAzohzODB9hEXBynxzWjOpX6Zg6xPKNobBTt/xVPCztt
	 8SB9y9vgA0d+li2AH8e3LQ6TLNKGI9iED2PuyowqPKFvF6/HCSgVOiE5RCSt6v0st5+3I
	 gO0wFXFx6gOE05bbnKPnwOaVqY+i6uBFHwfM+tohQqTEpbO38apgb7+4kPQPzjeMEiI+S
	 k8dw/9m8clDcW77FdDHvZRMJLSb3l1TK3F3Ifl/k+A0+Z+dMqKqDSOuE2Fz/PzXLx6Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792844112;
	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=gv1Nsn/K7ceq6TEu2FDszmP1j2tqBfoTAr5bozMOl74=;
	b=DFD1FPHV9AwYbZ6DWOVQmSw55uIDRS6LnyGd+Fl0Kgcko9GVMvLJao2gu4R6elo8m+Yb
	 dzZG305IrNmGxnxjfUaXo6Fu7S6z93RKA7yh+hzmLyV3jJSEqI9pZ8rdiRhphfpFm4xSV
	 PLUYp0Y6dDOIi5WYht9MMqLoSpy9gg25dBxgdlYom5DZewz7V+31evunvR6wskuOfLt6L
	 kjsRkTcjApyYZeGKlVBwwAqQ0YpH2X4U35KJDWjgiUlotY/RAxPlgo3Kccv2sblIkd8KS
	 woBG5CXpY2zdbQFGerVS9ZXZ385TbF+RCtYV7+Oy40CAaWxQ3QydG1oTncJA1Mu940A==
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=Xhxv16cU;
	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 8318C606A320;
	Sat, 24 Oct 2026 12:15:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Xhxv16cU
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=1792844091;
	b=OmWz5U6/DhnjMhptMgOLHkCedUx5b0TX01r6o7Bu9DTz40MOd1Vxbv6PNhbywnHZmlZI
	 fRFASuyskgkDexH3EJTgiGfQGM0NUU3PKGOmKP2iDfX6owFeHzh9v2SQol1206Zd3eSWD
	 34IpvWia/jYLw0q1qgCqOxpWAp24inFgJCLsytO74IBd8IDW6nUa/hXW2NegZSI+H9GDa
	 8wU4Z4cbkG8dIxefp4QN05xsWSDapHbw2GWoxeassvJAgHbJ6w8et2lqQy2SklTQgbR6j
	 d462GPVaIw/3ZRFRp5wmyU7+7Y4JYNn+rmVUZ3zqeZVdzU1cUJI/7ZWZ/7EBkcv53pw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792844091;
	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=gv1Nsn/K7ceq6TEu2FDszmP1j2tqBfoTAr5bozMOl74=;
	b=nVTRy8lD/lL14hZncQuk2GZQR2/tIg7Qbe5gz6RPBlXEd59IukLM4xF53IgJIrFgRxqQ
	 0l7qrJnJ9ScQWA1BWsGL5oa31drDeflzrTIEtRh0zeMJSy/tDvMewWckaRDfYmk3NBesO
	 t/eSLhiPKCzJp0SKsavtdr88kHVCS5XGVksShulJpHD97FGGruwTl8WB2Z+it3DbYOiMh
	 RPHh9LSzBDXYus907Nmix4PnJtX5R8jKsFMqcRBk1RkCn+X5P5dDqtgjBYvZkLFwYB3a8
	 /5Bf5tmbVW8LueFSxxEcLlH+QlJyAyyn4mr+8BJkK+HGeOTsuDntThD0q9+PyQvXkPw==
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=Xhxv16cU;
	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 58ED9606A33E;
	Sat, 24 Oct 2026 12:14:51 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BA0B1F031E6;
	Sat, 24 Oct 2026 12:14:50 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792844091;
	bh=gv1Nsn/K7ceq6TEu2FDszmP1j2tqBfoTAr5bozMOl74=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Xhxv16cU1Nb1Ra7vm0amkDFzWQvQiSdbLn7iYl6I7MoIhRCzrdodyccBZk3E9YDPu
	 G+RzoKFbU4hkxWHHIx2naXRGG5H1ov2oPxfSjUXLwj4IaF4kP23wBItZV4Qx+8Gz73
	 q4kx4FRLBGn+axmVRmzDHrkZsgNPZvx1pJcux0/zHKwAhzb8ZbomiEJ67z0a7Woj9M
	 tOpq3DryWR3OqoOGwlLltKtawuQllEKUEPylb1Xr2SrJqgr0vltUNP5z4PRfk32Vyf
	 21CwzCWWN2R5I7SWNqAnuaUuLyXlJ7nITgziK9lL9i1EUWVM6ny/Inb5WvhvU5d7EF
	 zI3sCmwgK5+pw==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org,
 pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
 ratbert@faraday-tech.com, edumazet@kernel.org, hkallweit1@gmail.com,
 linux@armlinux.org.uk, netdev@vger.kernel.org, devicetree@vger.kernel.org,
 linux-kernel@vger.kernel.org, andrew@lunn.ch
X-In-Reply-To: <20261020-support_ast2700-v4-4-4d36b40939b3@aspeedtech.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