On Tue, Sep 27, 2022 at 02:47:37PM +0200, Paolo Abeni wrote: > On Fri, 2022-09-23 at 18:45 +0300, Ioana Ciornei wrote: > > From: Robert-Ionut Alexa <robert-ionut.alexa@xxxxxxx> > > > > This patch allows the configuration of multiple buffer pools associated > > with a single DPNI object, each distinct DPBP object not necessarily > > shared among all queues. > > The user can interogate both the number of buffer pools and the buffer > > count in each buffer pool by using the .get_ethtool_stats() callback. > > > > Signed-off-by: Robert-Ionut Alexa <robert-ionut.alexa@xxxxxxx> > > Signed-off-by: Ioana Ciornei <ioana.ciornei@xxxxxxx> > > --- > > Changes in v2: > > - Export dpaa2_eth_allocate_dpbp/dpaa2_eth_free_dpbp in this patch to > > avoid a build warning. The functions will be used in next patches. > > (...) > > -/* Allocate and configure one buffer pool for each interface */ > > -static int dpaa2_eth_setup_dpbp(struct dpaa2_eth_priv *priv) > > +/* Allocate and configure a buffer pool */ > > +struct dpaa2_eth_bp *dpaa2_eth_allocate_dpbp(struct dpaa2_eth_priv *priv) > > { > > - int err; > > - struct fsl_mc_device *dpbp_dev; > > struct device *dev = priv->net_dev->dev.parent; > > + struct fsl_mc_device *dpbp_dev; > > struct dpbp_attr dpbp_attrs; > > + struct dpaa2_eth_bp *bp; > > + int err; > > > > err = fsl_mc_object_allocate(to_fsl_mc_device(dev), FSL_MC_POOL_DPBP, > > &dpbp_dev); > > @@ -3219,12 +3244,16 @@ static int dpaa2_eth_setup_dpbp(struct dpaa2_eth_priv *priv) > > err = -EPROBE_DEFER; > > else > > dev_err(dev, "DPBP device allocation failed\n"); > > - return err; > > + return ERR_PTR(err); > > } > > > > - priv->dpbp_dev = dpbp_dev; > > + bp = kzalloc(sizeof(*bp), GFP_KERNEL); > > + if (!bp) { > > + err = -ENOMEM; > > + goto err_alloc; > > + } > > It looks like 'bp' is leaked on later error paths. > Yes, I missed this. Thanks!