Re: [PATCH net-next 1/3] net: dsa: yt921x: Add STP/MST support
From: Simon Horman
Date: Fri Oct 24 2025 - 11:52:50 EST
On Fri, Oct 24, 2025 at 11:32:27AM +0800, David Yang wrote:
...
> +static int
> +yt921x_dsa_vlan_msti_set(struct dsa_switch *ds, struct dsa_bridge bridge,
> + const struct switchdev_vlan_msti *msti)
> +{
> + struct yt921x_priv *priv = to_yt921x_priv(ds);
> + u64 mask64;
> + u64 ctrl64;
> + int res;
> +
> + if (!msti->vid)
> + return -EINVAL;
> + if (msti->msti <= 0 || msti->msti >= YT921X_MSTI_NUM)
> + return -EINVAL;
> +
> + mask64 = YT921X_VLAN_CTRL_STP_ID_M;
Hi David,
YT921X_VLAN_CTRL_STP_ID_M is defined as follows in yt931x.h
#define YT921X_VLAN_CTRL_STP_ID_M GENMASK(39, 36)
This creates an unsigned long mask. However, on 32bit systems,
unsigned long is only 32 bits wide. So this will result in
a build error on such systems.
In order to avoid this I think the declaration of YT921X_VLAN_CTRL_STP_ID_M
should be updated to use GENMASK_ULL. This is also likely true
for other, as yet unused, #defines in yt931x.h.
> + ctrl64 = YT921X_VLAN_CTRL_STP_ID(msti->msti);
> +
> + mutex_lock(&priv->reg_lock);
> + res = yt921x_reg64_update_bits(priv, YT921X_VLANn_CTRL(msti->vid),
> + mask64, ctrl64);
> + mutex_unlock(&priv->reg_lock);
> +
> + return res;
> +}
...
--
pw-bot: changes-requested