From: Paolo Abeni <pabeni@redhat.com>
To: weiting.lee@airoha.com
Cc: netdev@vger.kernel.org, andrew@lunn.ch, hkallweit1@gmail.com,
linux@armlinux.org.uk, davem@davemloft.net, kuba@kernel.org,
edumazet@google.com, linux-kernel@vger.kernel.org, bjorn@mork.no,
ericwouds@gmail.com, frank-w@public-files.de,
joseph.lin@airoha.com, wenshin.chung@airoha.com,
lucien.jheng@airoha.com, albert-al.lee@airoha.com
Subject: Re: [PATCH v3 net-next] net: phy: air_en8811h: select LED GPIO pins based on AN8811HB package variant
Date: Thu, 10 Sep 2026 15:15:57 +0200 [thread overview]
Message-ID: <1a1e531c-90db-4a68-bce1-517ada2fe4a0@redhat.com> (raw)
In-Reply-To: <178897303632.219967.12350879229326827803@kernel.org>
On 9/9/26 6:57 PM, netdev-bot+sashiko@kernel.org wrote:
>> @@ -1115,6 +1167,12 @@ static int an8811hb_probe(struct phy_device *phydev)
>> /* MDIO_DEVS1/2 empty, so set mmds_present bits here */
>> phydev->c45_ids.mmds_present |= MDIO_DEVS_PMAPMD | MDIO_DEVS_AN;
>>
>> + /* Detect package variant */
>> + ret = air_phy_buckpbus_reg_read(phydev, AN8811HB_HWTRAP2, ®_val);
>> + if (ret < 0)
>> + goto err_dev_create;
>> + priv->is_an8811hbcn = FIELD_GET(AN8811HB_HWTRAP2_PKG, reg_val);
>> +
>> ret = en8811h_leds_setup(phydev);
>> if (ret < 0)
>> goto err_dev_create;
>
> [Severity: Medium]
> AN8811HB_HWTRAP2_PKG is GENMASK(14, 12), so FIELD_GET() yields a
> 3-bit value here, but it is stored straight into the bool
> priv->is_an8811hbcn. Any non-zero package code therefore collapses to
> true, which means the whole variant decision in
> an8811hb_led_gpio_setup() rests on the unstated assumption that
> AN8811HBCN is the only encoding with a non-zero value and AN8811HBN
> reads back exactly 0.
>
> If the field can take any other value - a second AN8811HBN encoding, a
> reserved code, or a future package - it lands in the
> AN8811HB_GPIO_OUTPUT_0115 branch and the driver drives GPIO 0/1/15
> plus the SEL1/SEL2 mux for a part whose LEDs are not on those pads.
> That failure mode is silent: the LEDs simply do not work, and there is
> nothing in the source that documents what the encoding actually is.
>
> Could you define the expected package identifiers as named constants
> and compare against them explicitly, e.g. something like
>
> pkg = FIELD_GET(AN8811HB_HWTRAP2_PKG, reg_val);
> priv->is_an8811hbcn = (pkg == AN8811HB_HWTRAP2_PKG_HBCN);
>
> so that unknown codes fall into the conservative branch rather than
> being treated as AN8811HBCN? If the hardware really only ever reports
> two values and 0 is guaranteed to mean AN8811HBN, please say so in a
> comment next to the assignment, since the reader cannot tell that from
> the mask alone. Also, is it worth warning (or failing probe) on an
> unrecognised package code rather than silently picking a GPIO mapping?
I think we are better off without per pkg macros until there are only
2 of them around.
All others are doubtful nit-picks.
@Weiting: note that you are requested to address sashiko comments
proactively.
/P
>
next prev parent reply other threads:[~2026-09-10 13:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 5:41 [PATCH] net: phy: air_en8811h: select LED GPIO pins based on AN8811HB package variant Weiting Lee
2026-08-27 18:01 ` Andrew Lunn
2026-08-28 5:05 ` [PATCH v2 net-next] " Weiting Lee
2026-08-28 13:07 ` Andrew Lunn
2026-08-31 6:58 ` 回覆: " WeiTing Lee (李威霆)
2026-09-07 1:56 ` [PATCH v3 " Weiting Lee
2026-09-09 16:57 ` netdev-bot+sashiko
2026-09-10 13:15 ` Paolo Abeni [this message]
2026-09-10 13:20 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1a1e531c-90db-4a68-bce1-517ada2fe4a0@redhat.com \
--to=pabeni@redhat.com \
--cc=albert-al.lee@airoha.com \
--cc=andrew@lunn.ch \
--cc=bjorn@mork.no \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ericwouds@gmail.com \
--cc=frank-w@public-files.de \
--cc=hkallweit1@gmail.com \
--cc=joseph.lin@airoha.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lucien.jheng@airoha.com \
--cc=netdev@vger.kernel.org \
--cc=weiting.lee@airoha.com \
--cc=wenshin.chung@airoha.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.