Subject: Re: [RFC PATCH net-next 12/16] net: mscc: ocelot: drop the use of the "lags" array

From: Alexandre Belloni <[email-masked]>
Date: Fri, 15 Jan 2021 13:02:30 +0100

On 15/01/2021 13:05:47+0200, Vladimir Oltean wrote:
> > -static void ocelot_set_aggr_pgids(struct ocelot *ocelot)
> > +static int ocelot_set_aggr_pgids(struct ocelot *ocelot)
> >  {
> > +	struct net_device **bonds;
> >  	int i, port, lag;
> >  
> > +	bonds = kcalloc(ocelot->num_phys_ports, sizeof(struct net_device *),
> > +			GFP_KERNEL);
> > +	if (!bonds)
> > +		return -ENOMEM;
> > +
> 
> I remember somebody complaining about the temporary memory allocation
> done here, but I can't seem to find that email for some reason.
> 
> Is it ok if I still keep the dynamic allocation there, though? Felix has
> up to 5 user ports, Seville has up to 9, Ocelot up to 11. I would like
> to not hardcode anything, in case (who knows!) more switches get added.
> 

I was probably the one, the main reason being that this make this
function able to fail. Removing the dynamic allocation would ensure it
never fails. However, I didn't suggest any other solution so I'm fine if
you keep it.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com