mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-10 20:48:12 +00:00
net: dsa: realtek: rtl8365mb: extract PHY OCP address halves with FIELD_GET
Extract the two OCP address halves with FIELD_GET() before handing them to FIELD_PREP() to build the ADDRESS register value. rtl8365mb_phy_ocp_prepare() previously fed FIELD_PREP() the raw ocp_addr >> 1 and >> 6. FIELD_PREP() masks the value to the field at run time, so that was correct for the current callers, which all pass a run-time register address. FIELD_PREP()'s compile-time width check only fires for a compile-time constant value. None reached it here: the address is computed as PHYREG_BASE + regnum * 2 from a run-time regnum. The EEE support that follows adds callers with constant OCP addresses (0xa5c4 etc.); clang folds those into the inlined ocp_prepare(), so the shifted constant now reaches the check, overflows the 5-/4-bit field and breaks the build (gcc does not fold it here). FIELD_GET() narrows each half to the field width first, so the value already fits. No functional change. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260918091722.3270534-3-o.rempel@pengutronix.de Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
4ef25721f7
commit
e9ba480ec8
1 changed files with 12 additions and 2 deletions
Loading…
Add table
Add a link
Reference in a new issue