Thread (12 messages) 12 messages, 3 authors, 2021-01-07

Re: [PATCH 4/6] dpaa2-eth: retry the probe when the MAC is not yet discovered on the bus

flat view

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-01-07 21:25:39

On Thu, Jan 07, 2021 at 05:36:36PM +0200, Ioana Ciornei wrote:
quoted hunk ↗ jump to hunk
From: Ioana Ciornei <ioana.ciornei@nxp.com>

The fsl_mc_get_endpoint() function now returns -EPROBE_DEFER when the
dpmac device was not yet discovered by the fsl-mc bus. When this
happens, pass the error code up so that we can retry the probe at a
later time.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index f3f53e36aa00..3297e390476b 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -4042,6 +4042,10 @@ static int dpaa2_eth_connect_mac(struct dpaa2_eth_priv *priv)
 
 	dpni_dev = to_fsl_mc_device(priv->net_dev->dev.parent);
 	dpmac_dev = fsl_mc_get_endpoint(dpni_dev);
+
+	if (PTR_ERR(dpmac_dev) == -EPROBE_DEFER)
+		return PTR_ERR(dpmac_dev);
+
 	if (IS_ERR_OR_NULL(dpmac_dev) || dpmac_dev->dev.type != &fsl_mc_bus_dpmac_type)
Hi Ioana

Given the previous change, i don't think dpmac_dev can be NULL, so you
can change this to IS_ERR(). IS_ERR_OR_NULL() often triggers extra
review work because it is easy to get it wrong, so removing it is nice.

       Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help