b53: allow ports with higher numbers than CPU port
[openwrt/staging/wigyori.git] / target / linux / generic / files / drivers / net / phy / b53 / b53_common.c
index 676e301559b64db4ac5bbc6997083dc7279bf850..d96d8b8b6d7eeb872ea1d82b602740a6fe7cce1b 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,