From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0EC2C43381 for ; Fri, 15 Jan 2021 12:03:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A2992371F for ; Fri, 15 Jan 2021 12:03:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730471AbhAOMDP (ORCPT ); Fri, 15 Jan 2021 07:03:15 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:36615 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729961AbhAOMDO (ORCPT ); Fri, 15 Jan 2021 07:03:14 -0500 X-Originating-IP: 86.202.109.140 Received: from localhost (lfbn-lyo-1-13-140.w86-202.abo.wanadoo.fr [86.202.109.140]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 17AC21C000A; Fri, 15 Jan 2021 12:02:30 +0000 (UTC) Date: Fri, 15 Jan 2021 13:02:30 +0100 From: Alexandre Belloni To: Vladimir Oltean Cc: Vladimir Oltean , Tobias Waldekranz , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org, UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Vivien Didelot , Claudiu Manoil Subject: Re: [RFC PATCH net-next 12/16] net: mscc: ocelot: drop the use of the "lags" array Message-ID: <20210115120230.GF3654@piout.net> References: <20201208120802.1268708-1-vladimir.oltean@nxp.com> <20201208120802.1268708-13-vladimir.oltean@nxp.com> <20210115110547.fwfyl3lnplbvqieu@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210115110547.fwfyl3lnplbvqieu@skbuf> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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