From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH net-next 1/2] dpaa2-eth: defer probe on object allocate Date: Thu, 8 Nov 2018 19:25:07 +0100 Message-ID: <20181108182507.GC5259@lunn.ch> References: <1541683054-22273-1-git-send-email-ioana.ciornei@nxp.com> <1541683054-22273-2-git-send-email-ioana.ciornei@nxp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "netdev@vger.kernel.org" , "davem@davemloft.net" , Ioana Ciocoi Radulescu To: Ioana Ciornei Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:55585 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726751AbeKIEB4 (ORCPT ); Thu, 8 Nov 2018 23:01:56 -0500 Content-Disposition: inline In-Reply-To: <1541683054-22273-2-git-send-email-ioana.ciornei@nxp.com> Sender: netdev-owner@vger.kernel.org List-ID: On Thu, Nov 08, 2018 at 01:17:47PM +0000, Ioana Ciornei wrote: > The fsl_mc_object_allocate function can fail because not all allocatable > objects are probed by the fsl_mc_allocator at the call time. Defer the > dpaa2-eth probe when this happens. > > Signed-off-by: Ioana Ciornei > --- > drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 30 +++++++++++++++++------- > 1 file changed, 21 insertions(+), 9 deletions(-) > > diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c > index 88f7acc..71f5cd4 100644 > --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c > +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c > @@ -1434,8 +1434,11 @@ static struct fsl_mc_device *setup_dpcon(struct dpaa2_eth_priv *priv) > err = fsl_mc_object_allocate(to_fsl_mc_device(dev), > FSL_MC_POOL_DPCON, &dpcon); > if (err) { > - dev_info(dev, "Not enough DPCONs, will go on as-is\n"); > - return NULL; > + if (err == -ENXIO) > + err = -EPROBE_DEFER; > + else > + dev_info(dev, "Not enough DPCONs, will go on as-is\n"); > + return ERR_PTR(err); > } > > err = dpcon_open(priv->mc_io, 0, dpcon->obj_desc.id, &dpcon->mc_handle); > @@ -1493,8 +1496,10 @@ static void free_dpcon(struct dpaa2_eth_priv *priv, > return NULL; > > channel->dpcon = setup_dpcon(priv); > - if (!channel->dpcon) > + if (IS_ERR_OR_NULL(channel->dpcon)) { > + err = PTR_ERR(channel->dpcon); > goto err_setup; > + } Hi Ioana You need to be careful with IS_ERR_OR_NULL(). If it is a NULL, PTR_ERR() is going to return 0. You then jump to the error cleanup code, but return 0, meaning everything is O.K. Andrew