On Wed, Nov 18, 2020 at 11:03:56PM +0100, Michael Grzeschik wrote: > To get the driver working with other chips using different port counts > the dyn_mac_table should be flushed depending on the amount of physical > ports. > > Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> > > --- > v1: - based on "[PATCH v4 05/11] net: dsa: microchip: ksz8795: dynamica > allocate memory for flush_dyn_mac_table" > - lore: > https://lore.kernel.org/netdev/20200803054442.20089-6-m.grzesc...@pengutronix.de/ > --- > drivers/net/dsa/microchip/ksz8795.c | 8 ++++++-- > drivers/net/dsa/microchip/ksz8795_reg.h | 2 -- > 2 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/dsa/microchip/ksz8795.c > b/drivers/net/dsa/microchip/ksz8795.c > index 9ea5ec61513023f..418f71e5b90761c 100644 > --- a/drivers/net/dsa/microchip/ksz8795.c > +++ b/drivers/net/dsa/microchip/ksz8795.c > @@ -750,11 +750,14 @@ static void ksz8795_port_stp_state_set(struct > dsa_switch *ds, int port, > > static void ksz8795_flush_dyn_mac_table(struct ksz_device *dev, int port) > { > - u8 learn[TOTAL_PORT_NUM]; > int first, index, cnt; > struct ksz_port *p; > + u8 *learn = kzalloc(dev->port_cnt, GFP_KERNEL);
Using DSA_MAX_PORTS makes things simpler. Andrew