All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Christian Marangi" <ansuelsmth@gmail.com>
Cc: lee@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
	conor+dt@kernel.org, mfd@lists.linux.dev
Subject: Re: [PATCH net-next v20 05/10] net: phy: Add Airoha AN8855 Internal Switch Gigabit PHY
Date: Tue, 18 Aug 2026 09:03:19 +0000	[thread overview]
Message-ID: <20260818090319.DB1FB1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260817082034.20326-7-ansuelsmth@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Broken exact-match search causes silent calibration fallback for intermediate eFuse values
- [Medium] API contract violation: an8855_set_downshift silently ignores unsupported requested retry counts
--

--- Patch [5]: [PATCH net-next v20 05/10] net: phy: Add Airoha AN8855 Internal Switch Gigabit PHY ---
commit e5962bf38329639f7d4d409e75314ddeedd25edf
Author: Christian Marangi <ansuelsmth@gmail.com>

net: phy: Add Airoha AN8855 Internal Switch Gigabit PHY

Add support for Airoha AN8855 Internal Switch Gigabit PHY.
This is a simple PHY driver to configure and calibrate the PHY for the
AN8855 Switch with the use of NVMEM cells.

> diff --git a/drivers/net/phy/air_an8855.c b/drivers/net/phy/air_an8855.c
> new file mode 100644
> index 0000000000000..bc22256fd5f95
> --- /dev/null
> +++ b/drivers/net/phy/air_an8855.c

[ ... ]

> +static int an8855_get_r50ohm_val(struct device *dev, const char *calib_name,
> +				 u8 *dest)
> +{
> +	u32 shift_sel, val;
> +	int ret;
> +	int i;
> +
> +	ret = nvmem_cell_read_u32(dev, calib_name, &val);
> +	if (ret)
> +		return ret;
> +
> +	shift_sel = FIELD_GET(AN8855_SWITCH_EFUSE_R50O, val);
> +	for (i = 0; i < ARRAY_SIZE(dsa_r50ohm_table); i++)
> +		if (dsa_r50ohm_table[i] == shift_sel)
> +			break;

[Severity: High]
Will this exact match condition fail for intermediate physical calibration
values from the eFuse?

If the hardware reads a valid intermediate value like 100 or 102 that isn't
explicitly present in the dsa_r50ohm_table, the loop will exhaust the array
without matching. This would cause the search to silently discard the
calibration data and fall back to the default uncalibrated value.

Should this use a closest-match or bound search to safely handle
intermediate ADC/calibration values without dropping them?

> +
> +	if (i < 8 || i >= ARRAY_SIZE(dsa_r50ohm_table))
> +		*dest = dsa_r50ohm_table[25];
> +	else
> +		*dest = dsa_r50ohm_table[i - 8];
> +
> +	return 0;
> +}

[ ... ]

> +static int an8855_set_downshift(struct phy_device *phydev, u8 cnt)
> +{
> +	u16 ds = cnt != DOWNSHIFT_DEV_DISABLE ? AN8855_PHY_EN_DOWN_SHIFT : 0;
> +
> +	return phy_modify_paged(phydev, AN8855_PHY_PAGE_EXTENDED_1,
> +				AN8855_PHY_EXT_REG_14, AN8855_PHY_EN_DOWN_SHIFT,
> +				ds);
> +}

[Severity: Medium]
Does this silently ignore unsupported downshift retry counts?

The function treats the user-provided count only as a boolean toggle. If
userspace configures ETHTOOL_PHY_DOWNSHIFT with a specific retry count
(e.g. via ethtool), the driver unconditionally enables downshift but ignores
the requested count.

If the driver only supports a fixed internal count, should it validate the
user's input and return -EOPNOTSUPP or -EINVAL when the requested count
doesn't match DOWNSHIFT_DEV_DISABLE or DOWNSHIFT_DEV_DEFAULT_COUNT?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260817082034.20326-1-ansuelsmth@gmail.com?part=5

  reply	other threads:[~2026-08-18  9:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17  8:20 [PATCH net-next v20 00/10] net: dsa: Add Airoha AN8855 support Christian Marangi
2026-08-17  8:20 ` [PATCH net-next v20 01/10] dt-bindings: net: dsa: Document support for Airoha AN8855 DSA Switch Christian Marangi
2026-08-18  9:03   ` sashiko-bot
2026-08-17  8:20 ` [PATCH net-next v20 02/10] dt-bindings: net: Document support for AN8855 Switch Internal PHY Christian Marangi
2026-08-18  9:03   ` sashiko-bot
2026-08-17  8:20 ` [PATCH net-next v20 03/10] dt-bindings: mfd: Document support for Airoha AN8855 Switch SoC Christian Marangi
2026-08-18  9:03   ` sashiko-bot
2026-08-17  8:20 ` [PATCH net-next v20 04/10] mfd: an8855: Add support for Airoha AN8855 Switch MFD Christian Marangi
2026-08-18  9:03   ` sashiko-bot
2026-08-17  8:20 ` [PATCH net-next v20 04/10] mfd: an8855: Add support for Airoha AN8855 Switch Christian Marangi
2026-08-18  1:19   ` Wayen Yan
2026-08-17  8:20 ` [PATCH net-next v20 05/10] net: phy: Add Airoha AN8855 Internal Switch Gigabit PHY Christian Marangi
2026-08-18  9:03   ` sashiko-bot [this message]
2026-08-17  8:20 ` [PATCH net-next v20 06/10] net: dsa: tag_mtk: add Airoha variant usage of this TAG Christian Marangi
2026-08-18  9:03   ` sashiko-bot
2026-08-17  8:20 ` [PATCH net-next v20 07/10] MAINTAINERS: add myself as maintainer for Airoha AN8855 Switch Christian Marangi
2026-08-17  8:20 ` [PATCH net-next v20 08/10] net: dsa: mt7530: move MDIO bus locking into regmap Christian Marangi
2026-08-18  9:03   ` sashiko-bot
2026-08-17  8:20 ` [PATCH net-next v20 09/10] net: dsa: mt7530: generalize and move common function to lib module Christian Marangi
2026-08-18  9:03   ` sashiko-bot
2026-08-17  8:20 ` [PATCH net-next v20 10/10] net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver Christian Marangi
2026-08-18  9:03   ` sashiko-bot
2026-08-17 15:38 ` [PATCH net-next v20 00/10] net: dsa: Add Airoha AN8855 support Jakub Kicinski

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=20260818090319.DB1FB1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ansuelsmth@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.