Re: [PATCH net-next v8 4/4] net: dsa: add basic initial driver for MxL862xx switches

From: Andrew Lunn

Date: Tue Jan 27 2026 - 13:38:24 EST


On Tue, Jan 27, 2026 at 04:07:10PM +0000, Daniel Golle wrote:
> On Tue, Jan 27, 2026 at 04:04:10PM +0100, Andrew Lunn wrote:
> > > > int mxl862xx_to_zephyr_errno(u16 reg)
> > > so that would then just be
> > > return (s16)reg;
> > > right?
> >
> > Yes.
>
> +1
>
> Maybe better to check if bit 16~31 is actually zero as well, so
> int mxl862xx_to_zephyr_errno(int reg)
> {
> if (reg >= 0 && reg <= U16_MAX)
> return (s16)reg;
>
> return 0;

If bits 16~31 are not zero, i would say the MDIO driver is broken, and
we should fix it. Returning 0 is going to hide such issues. If you are
worried about it, at least add a WARN_ON() or something.

Andrew