๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22413

Re: [PATCH net 3/5] net: dsa: mt7530: register the GPIO controller last in setup

#22413
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 09:27
62 lines
10522 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: dsa: mt7530: mt7530_setup_gpio() still runs before
  fallible setup steps

--

> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -2585,6 +2585,11 @@ mt7530_setup(struct dsa_switch *ds)
>  		}
>  	}
>  
> +	/* Flush the FDB table */
> +	ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL);
> +	if (ret < 0)
> +		return ret;
> +
>  #ifdef CONFIG_GPIOLIB
>  	if (of_property_read_bool(priv->dev->of_node, "gpio-controller")) {
>  		ret = mt7530_setup_gpio(priv);

[Severity: Medium]
The commit message says this makes the GPIO controller visible only
once every fallible step of setup has succeeded. However, mt7530_setup()
is only the priv->info->sw_setup() callback. After it returns 0,
mt753x_setup() still calls mt7530_setup_irq() and mt7530_setup_mdio().
Both of those can fail, and mt7530_setup_irq() can also return
-EPROBE_DEFER.

If either of them fails, the gpio_chip that mt7530_setup_gpio()
registered with devm_gpiochip_add_data() on priv->dev stays published.
Once the next patch disables core_pwr and io_pwr on the failure path,
consumers would be left poking MT7530_LED_GPIO_* registers on an
unpowered switch. That is the situation this patch says it prevents.

The same applies to teardown. The chip is tied to devres on priv->dev,
not to the DSA setup/teardown cycle. Consider a multi-switch tree where
a sibling switch fails or defers. mt753x_teardown() then disables the
regulators without unbinding priv->dev, so the chip remains registered.
The next dsa_tree_setup() attempt would run mt7530_setup_gpio() again
and add a second controller.

Should the GPIO registration move to the end of mt753x_setup(), after
mt7530_setup_mdio(), with an explicit gpiochip_remove() in the error
path and in mt753x_teardown()? Or would you rather register it from
probe instead? Either way, the commit message should not claim it is
the last fallible step as things stand.

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179550875789.4156.361477684651496992%40mail.zgclab.edu.cn
Technical Details
Message-ID: <179559883260.3135.17892460412824046133@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371181-linux-kernel-netdev=dewy.ru
References: <179550875790.4156.7464757884919680732@mail.zgclab.edu.cn>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371181-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 3/5] net: dsa: mt7530: register the GPIO controller
 last in setup
Date: Wed, 25 Nov 2026 09:27:12 +0000
Organization: Usenet Network
Message-ID: <179559883260.3135.17892460412824046133@kernel.org>
References: <179550875790.4156.7464757884919680732@mail.zgclab.edu.cn>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="167141"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:YN5rKdnMEhdgug6ecUb5D8Fl90c= sha256:Oey7RnNEhMaybvkg9YZsqvLRhzEozDYKMpMejVkZcwI=
	sha1:bR4K/UK/8NwbxzUW7Gktds+RrWU= sha256:WdmMUDxJZXEu4RPTqS+1feHNx2POyrX3EtDswZRsX6c=
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 00DCC125E50; Wed, 25 Nov 2026 12:27:30 +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 UhnyS12PqRtX;
	Wed, 25 Nov 2026 12:27:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371181-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 5F59C125E4F; Wed, 25 Nov 2026 12:27:16 +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 634BC398BB; Wed, 25 Nov 2026 09:27:15 +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=1795598835;
	b=AwF/mU6rbjorVTqE5arYI5ieui0UxgexY27VRPezpkLThVijTSsxkCYD28EjiBO0FpdO
	 37Gv8PvpFVH+EWvLkC65jU7beq/+Xb15Ey+/iEY4ApT2kiI4Pl3irt08poMkwN/5Vbdob
	 RtND21mVDcaRj/6VescvIC1FZhmXfKr1iZhkZEwNOkst++kOrd0iCPaTY2doLG9gfp7qP
	 TwWz2jKZprKwW5IUQjrpKXtudoVM+D79Ez1pEI/r0CWt09W0foUie3+q1eMlaoSQFVrQA
	 /2x56TEVo7gIJ2Fddt+e2s0VptuHVLkqWE3WeYz3AjMXy1BYheuvFkrEc9urDZvuoTA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795598835;
	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=P8tTFRZKMoV9ILmjWhm/Qj+eqvtd5b4s7jrXn6M6sCA=;
	b=iVMT1rXZFTw5DhDWCay2PTrBnjFpYyv2cKdx9pTa10gNf/jCV5f4PqpI/nB/yJTlsBLs
	 uPjfmh/RG/Dn0YsGDtaXaROSRyBYnEGt5ApNze9mbEIvIU2uC/LpJyazzMcuDGAjMu5Je
	 wwCVapKK8HRRAvidcqOq4d4YSW/YFBH8QB1tBwitpx4v2oLShjrlJErCYTFBejEim3vjy
	 cWE0/NSjM3/b91S5AsMsSW+pxDdE6dLwtmRY9llRd7mq3Li9p06sGtqPyIvSaBFmRUfQV
	 aUHrZTXONEPsfHjnuOtp7Kn3AdwjlpDWctI7HxlEh8Fr2NKhmXvVFIJAu6SZAGsXW1g==
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=csCgOiTE;
	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 3AFB3606A32A;
	Wed, 25 Nov 2026 09:27: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=csCgOiTE
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=1795598834;
	b=i4esH4V16aoGlquuiUVpGj1mR/kJydQkuo0f2diT5GnEfTCtXUcI/216BU/gQXJ1Z9wU
	 cXaX06ZJGhYJGI6JGZh3gJL0FhNfBk6g2YDw3YdVsW2/of5XaoohV9sNZPzN9WH0ne+df
	 8r8WfqbS5bM8m1VX6wv0cf+rixP4h3v9YxGAqSDIyh9mZ5h9Dky4jD/7GKC/ak9rOgo2a
	 e2oMVJQzf8h1B3/DNWbm3iL454mV7n+4k1tN3pRIz9sJZiomdLWn1b3ny0mTA64hfeXkR
	 p/lYe3wun/YjCpR+DnhfKyIBPovxM3b/r+JnqoI/oXMj9vovXsd2sbFqqdW1CKUgL0w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795598834;
	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=P8tTFRZKMoV9ILmjWhm/Qj+eqvtd5b4s7jrXn6M6sCA=;
	b=Jt0KzhXtKj6NY1G8AK/kuJwSWva1Q6+EZ6Xa7A2vkoC1VIsBJRxxUp/Ikg1l1bvXMQU5
	 J67iKX5zOCyht/pQRuorUk7ZmqftOR2EbA2qxCTZnhQEq3MiSE0xcyuQ5SbSBzxoAygaD
	 0s0TFPS2dJcN19paiXdcaVXlN7cDhkAyjP6qOmk0O8Mltcn5Ufdl8qqZEt+Ma2NokO2ZQ
	 QclF0Al9UEeRJpyEvPJfeNpz7LAu6Cri9wodVJIkwl1bqUyLnslLTWtsgpopaHCjKYl7V
	 siwuyL2hLg9T99ouW4eyP0DZNV5OP03HrFxYcv1mHkM0OV2P7Ur6ypBl/+g/+Qb2FGQ==
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=csCgOiTE;
	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 57B78606A321;
	Wed, 25 Nov 2026 09:27:14 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 157361F000C0;
	Wed, 25 Nov 2026 09:27:13 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795598833;
	bh=P8tTFRZKMoV9ILmjWhm/Qj+eqvtd5b4s7jrXn6M6sCA=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=csCgOiTEhmqVdAe5KLvf/KId4CUz5vLa16QtG35bS9sZm1GXuijGnS/S3MO+RPaga
	 fxNDCfQFBuxz11T1yQvd/M/+rjHNje5veEhF91UvmTAN+OXyL3lGglzKTrEE11TDps
	 vUP9c4glv6izxOtNJth8c51S6+fW2srjzeSkLLw3GoJtq9UQtODO3dbnXqMcFF+bpR
	 SQBx18Py/YdoKlJtVGC23SmLwKCbkP99fdXgXVy6jCqxESjHTV1RPwRSjkhlu0BqLU
	 wbmXubAMzcyzq+hivj9Iy42i8hmN0J4cnrDUVlH7j0MoQGjf6vxkuqcUeC2w0hx8OJ
	 CPaCPmi8NbQtg==
X-Cc: chester.a.unal@arinc9.com, daniel@makrotopia.org, andrew@lunn.ch,
 olteanv@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
 pabeni@redhat.com, matthias.bgg@gmail.com,
 angelogioacchino.delregno@collabora.com, netdev@vger.kernel.org,
 linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org,
 linux-kernel@vger.kernel.org
X-In-Reply-To: <179550875790.4156.7464757884919680732@mail.zgclab.edu.cn>
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