]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
net: dsa: mv88e6xxx: allocate the number of ports
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Thu, 30 Mar 2017 21:37:10 +0000 (17:37 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sat, 1 Apr 2017 19:22:57 +0000 (12:22 -0700)
The current code allocates DSA_MAX_PORTS ports for a Marvell dsa_switch
structure. Provide the exact number of ports so the corresponding
ds->num_ports is accurate.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx/chip.c

index fb6a723c213787410cdc0231a904ad96de419049..28bdfadbf05008452b9ef74af26462d121ae9860 100644 (file)
@@ -4286,7 +4286,7 @@ static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip)
        struct device *dev = chip->dev;
        struct dsa_switch *ds;
 
-       ds = dsa_switch_alloc(dev, DSA_MAX_PORTS);
+       ds = dsa_switch_alloc(dev, mv88e6xxx_num_ports(chip));
        if (!ds)
                return -ENOMEM;