Re: [PATCH net-next 10/13] net: dsa: lantiq_gswip: Fix error message in gswip_add_single_port_br()

Martin Schiller
2024-06-07T13:54:01Z

On 2024-06-07 15:50, Vladimir Oltean wrote:
> On Fri, Jun 07, 2024 at 03:34:13PM +0200, Martin Schiller wrote:
>> On 2024-06-07 13:27, Vladimir Oltean wrote:
>> > Isn't even the original condition (port >= max_ports) dead code? Why not
>> > remove the condition altogether?
>>
>> I also agree here if we can be sure, that .port_enable,
>> .port_bridge_join and
>> .port_bridge_leave are only called for "valid" (<= max_ports) ports.
>
> dsa_switch_parse_ports_of() has:
>
> if (reg >= ds->num_ports) {
> dev_err(ds->dev, "port %pOF index %u exceeds num_ports (%u)\n",
> port, reg, ds->num_ports);
> of_node_put(port);
> err = -EINVAL;
> goto out_put_node;
> }

OK, so I will remove this check altogether.