b53: allow ports with higher numbers than CPU port
[openwrt/openwrt.git] / target / linux / generic / files / drivers / net / phy / b53 / b53_common.c
index 676e301..d96d8b8 100644 (file)
@@ -1370,9 +1370,8 @@ static int b53_switch_init(struct b53_device *dev)
                        sw_dev->cpu_port = 5;
        }
 
-       /* cpu port is always last */
-       sw_dev->ports = sw_dev->cpu_port + 1;
        dev->enabled_ports |= BIT(sw_dev->cpu_port);
+       sw_dev->ports = fls(dev->enabled_ports);
 
        dev->ports = devm_kzalloc(dev->dev,
                                  sizeof(struct b53_port) * sw_dev->ports,