From: Andrew Lunn <andrew@lunn•ch>
To: Ioana Ciornei <ioana.ciornei@nxp•com>
Cc: "netdev@vger•kernel.org" <netdev@vger•kernel.org>,
"davem@davemloft•net" <davem@davemloft•net>,
Ioana Ciocoi Radulescu <ruxandra.radulescu@nxp•com>
Subject: Re: [PATCH net-next 1/2] dpaa2-eth: defer probe on object allocate
Date: Thu, 8 Nov 2018 19:25:07 +0100 [thread overview]
Message-ID: <20181108182507.GC5259@lunn.ch> (raw)
In-Reply-To: <1541683054-22273-2-git-send-email-ioana.ciornei@nxp.com>
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 <ioana.ciornei@nxp•com>
> ---
> 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
next prev parent reply other threads:[~2018-11-09 4:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-08 13:17 [PATCH net-next 0/2] dpaa2-eth: defer probe on object allocate Ioana Ciornei
2018-11-08 13:17 ` [PATCH net-next 1/2] " Ioana Ciornei
2018-11-08 18:25 ` Andrew Lunn [this message]
2018-11-09 14:01 ` Ioana Ciornei
2018-11-09 14:16 ` Andrew Lunn
2018-11-09 14:24 ` Ioana Ciornei
2018-11-08 13:17 ` [PATCH net-next 2/2] dpaa2-ptp: defer probe when portal allocation failed Ioana Ciornei
2018-11-09 3:28 ` [PATCH net-next 0/2] dpaa2-eth: defer probe on object allocate David Miller
2018-11-09 3:29 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181108182507.GC5259@lunn.ch \
--to=andrew@lunn$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=ioana.ciornei@nxp$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=ruxandra.radulescu@nxp$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox