Re: [PATCH v3 2/2] net: pcs: rzn1-miic: Verify port number from dtb

From: Andrew Lunn

Date: Mon Sep 14 2026 - 14:12:17 EST


> > While reviewing this, i noticed:
> >
> > /* Adjust for 0 based index */
> > dt_val[port + !miic->of_data->miic_port_start] = conf;
> >
> > Is the ! correct?
> >
> > Andrew
>
> Yes, this is correct because dt_val[1] is where the port config entries
> start.
>
> Depending on the SoC, the port numbering might be 0 or 1 based, so this
> prevents the input config entry at dt_val[0] from being overwritten. The
> logic works out to the same as:
>
> index = port + 1 - miic->of_data->miic_port_start

It is unusual to see a ! used like this in the middle of an
addition. Sometimes the more verbose form is less likely to get
questioned asked...

Andrew