๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24896

Re: [PATCH net 10/14] net: phy: as21xxx: Fix LED hw control set for unsupported rules

#24896
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 01:50
83 lines
11036 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The code fix in as21xxx_led_hw_control_set()
  (drivers/net/phy/as21xxx.c) is correct.

--

net: phy: as21xxx: Fix LED hw control set for unsupported rules

With this patch, as21xxx_led_hw_control_set() returns -EOPNOTSUPP when
the requested rules match no entry in as21xxx_led_supported_pattern.
Before, it wrote event 0 to the LED register and returned success. The
patch also drops the zero initialization of val, which is no longer
needed.

> as21xxx_led_hw_control_set() looks up the requested rules in
> as21xxx_led_supported_pattern, but does not check whether a match was
> found.  If the rules are not in the table, val keeps its initial value
> of 0, so phy_modify_mmd() still gets called, overwriting the current LED
> configuration with event 0, and the function returns success.

[Severity: Low]
The code change looks correct. Could the commit message also say how an
unsupported rule set reaches this callback, and what the user sees?

The only in-tree caller of hw_control_set() is set_baseline_state() in
drivers/leds/trigger/ledtrig-netdev.c. The usual ways into it are
netdev_led_attr_store() and NETDEV_UP. Both go through can_hw_control(),
which calls hw_control_is_supported() first. as21xxx_led_hw_is_supported()
checks the same as21xxx_led_supported_pattern table, so from the message
alone the bug can look unreachable.

It can be reached through netdev_trig_activate():

drivers/leds/trigger/ledtrig-netdev.c:netdev_trig_activate() {
    ...
			trigger_data->hw_control = true;
			set_device_name(trigger_data, name, strlen(name));

			rc = led_cdev->hw_control_get(led_cdev, &mode);
			if (!rc)
				trigger_data->mode = mode;
    ...
}

as21xxx_led_hw_control_get() returns -EINVAL when the A_EVENT field holds
a value that is not in the table. as21xxx_led_brightness_set() writes two
such values: VEND1_LED_REG_A_EVENT_ON and VEND1_LED_REG_A_EVENT_OFF.

One way to trigger this is to set the trigger to none, which turns the
LED off and writes OFF, and then set it back to netdev. After that,
hw_control is true but trigger_data->mode is still 0.

Any later NETDEV_CHANGE, NETDEV_DOWN or NETDEV_CHANGENAME event, or a
write to device_name, then calls hw_control_set() with rules == 0:

drivers/leds/trigger/ledtrig-netdev.c:set_baseline_state() {
    ...
	if (trigger_data->hw_control) {
		led_cdev->hw_control_set(led_cdev, trigger_data->mode);

		return;
	}
    ...
}

Before this patch that wrote event 0, which is VEND1_LED_REG_A_EVENT_ON_10.
The LED was silently reprogrammed to "on at 10M link".

set_baseline_state() also ignores the return value, so the caller never
sees the new -EOPNOTSUPP. In practice, the fix just stops the register
from being overwritten.

Would it help reviewers and stable backporters if the commit message
described this path and the "on at 10M link" symptom?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-as21xxx-fixes-v1-0-1bd2eae6ccbc%40collabora.com
Technical Details
Message-ID: <179608985700.3146.11686332387528441969@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374618-linux-kernel-netdev=dewy.ru
References: <20261130-as21xxx-fixes-v1-10-1bd2eae6ccbc@collabora.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374618-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 10/14] net: phy: as21xxx: Fix LED hw control set for
 unsupported rules
Date: Tue, 01 Dec 2026 01:50:57 +0000
Organization: Usenet Network
Message-ID: <179608985700.3146.11686332387528441969@kernel.org>
References: <20261130-as21xxx-fixes-v1-10-1bd2eae6ccbc@collabora.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1586921"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:eiDf6ra3mMXbpq7fhnA++tL8Uck= sha256:b3CcArfnfkKZxwK9YogwUVmMASauecntNqFuwt2R27E=
	sha1:fvCufdUqyQT+hBYINiP2x42pNX0= sha256:3NlZ3OO194HFIeGG6oaaYNe43OwNvD5lHtjdR00VlU0=
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 8B2201171F7; Tue,  1 Dec 2026 04:51:18 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.5
X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31
	tests=[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 ieSRsKCRAcd8;
	Tue,  1 Dec 2026 04:51:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-374618-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 3F4AA1171F1; Tue,  1 Dec 2026 04:51:02 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 87822601B7C; Tue,  1 Dec 2026 01:51:02 +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=1796089859;
	b=qK+4bG7MXpNFvjNzPyU5IsbYho4twXSnAlCOhkGPKPwcMZVyAn1jFWMkf0u6LpA+oG8T
	 m4MAOEYH0QkGD+WCKtAgjIa2ylKCB5UbAsIwVk1hkZrGwPfLelC8Eumlshc7Sj4jmayrL
	 +54yTWsFlbjLksu3XGcyT6YE1LH2171AyGlLxVyRScby7E9sxnvClem/x+CzJp6wvsS47
	 uMMf3WFd/vko72UbQ67sLDM/843nceffb07rzgtQSxTkPporcHzIjfpTLZIqFBKmtKKba
	 OJ1Z6bnflrm+rewouoQqYM3X0R6uIFQy0M8t2tPQgaBwCeDnjD7oP601NB1piWuUMxw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796089859;
	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=dVwx70nrP09hKdCLftOKYZmPd1shB1KXePoygrQi6Jc=;
	b=FQWCV6Fm0upTfpHiY82/peoT+ebkkxzODY9cz1i284B+WMz4HAy6sfFMOUBehwrfbS6a
	 GBSSxGFBnqqPqHl1K5YcnGwCVT0E/qM0+E93q+9cMRy4toMxJcfICmDAU8kkZNJmos8PV
	 nC96FvdJgxtmXtbZHpiuVmtEH27lXavnjrswfrokCTlwpWleTyKNVOm/SEMw6kc6haeT9
	 lHge0NgjntoInmcoizFJ2YQVWOJJVjN98ySBa+FZYnCq+/pDt2gMgUww0aqsLqoB/+SLt
	 HMuLlwIoMwpAp0zDdSNep+ma1coZVdBdalc7lktyBfqFsX2knkfuUQ2SjtRvdP4CIpQ==
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="gh8frU/F";
	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 2E063606A33B;
	Tue,  1 Dec 2026 01:50:59 +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=gh8frU/F
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=1796089858;
	b=HVbdLflZI0TF+nyWQc5iIDw920ersBKLyidL0Hb7ns28xt0lEZ0s4T873NIamT+phfB8
	 xZ1j0bIVGuOmuwc6nsFpGnevwLb/4ZW9MFNTCvWkzdPqJjo8W53nQUH0uxKfbfhGpa1JI
	 VqoSCCKCJWCQCfgYNlmrKMrxv97qyWT6JcRfPjS6xiW19CZmfVSQpq7eXPuAAdBv1ydWq
	 dztoqp0MnLx5A7VdSvyiYxobk3mSwxcFYBDX8OBM3Dkj3lJgoLWvCcMGgPaX9es0ZPc8f
	 pKJglaDszvdoio4A+VszTgTFFgiylYZW326vNZR3yx7PlBGL1botGwXnkUstS8uYxVw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796089858;
	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=dVwx70nrP09hKdCLftOKYZmPd1shB1KXePoygrQi6Jc=;
	b=W+ETbL64ynwfZ09Y6CXjzykN9+rklWqFscLaOMjrhdMYb2ObR1KWeIGCTI7XLmlKyGNn
	 pvtl3W9jl8u8cDuY8GzfwC34jF3r4Kqhvrp0mEAPKWMk2VM1z7UWwkLxZbXeZey7PexCh
	 wWjbx9fyzeJPA8OodI4tPe5L89vTUV+sKLfXsjJ3tF5dVapGoGSsB5VOATNvctjn95KIg
	 tTlJWIDR9cs71G2GEXtk0FrJh437mCeZB6vav9edcVkgY87fR7ttinJxgkRkaWyfhUuOl
	 d/7dv9CJnADThBvelHH8d9KT1x1thQMhGWUVD6GPfmOQhgkJUqzTzswRxEznaGVYIVA==
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="gh8frU/F";
	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 5111D606A336
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 01:50:58 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79CF71F00893;
	Tue,  1 Dec 2026 01:50:57 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796089858;
	bh=dVwx70nrP09hKdCLftOKYZmPd1shB1KXePoygrQi6Jc=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=gh8frU/FqZxqGUUp8Wo9IVTEXjAH07FXeBrHBTUVVyQkVdnwCbCY/iX+kHZ09xQpK
	 4l+ZYkKV73trSKcs+h+IvYqY8sBHpRYfGWfSFUsE80cXX9Ik5lwibcRcXKFnOJMpSm
	 3t1NNS6nhJKnehXnxuV5uB7qowJpsrpWy/UhazaRe1w2dyFS9mbQFbmrA0nvPDoXmu
	 KlnCmo19LbEQK5S5ZYt7MamrUU88P4PhYtipEnGqGddWVOiXtIcm/eCENL8u6Zb9bs
	 JP7C2inPLWVr2300UOIahtxTgoJC2ilvVmIGUhS9fnrhEHw2RE2dPWn4as95qba114
	 6kDpxws98gPjg==
X-Cc: ansuelsmth@gmail.com, andrew@lunn.ch, hkallweit1@gmail.com,
 linux@armlinux.org.uk, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, kernel@collabora.com,
 netdev@vger.kernel.org
X-In-Reply-To: <20261130-as21xxx-fixes-v1-10-1bd2eae6ccbc@collabora.com>
X-sashiko-severity: Low
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