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

From: Vladimir Oltean
Date: Fri Jun 07 2024 - 09:51:14 EST


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;
}