[PATCH net-next] net: dsa: mxl862xx: cancel pending work on probe error

Daniel Golle posted 1 patch 1 day, 9 hours ago
drivers/net/dsa/mxl862xx/mxl862xx.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
[PATCH net-next] net: dsa: mxl862xx: cancel pending work on probe error
Posted by Daniel Golle 1 day, 9 hours ago
Call mxl862xx_host_shutdown() in case dsa_register_switch() returns
an error, so any still pending crc_err_work get canceled.

Fixes: a319d0c8c8ce ("net: dsa: mxl862xx: add CRC for MDIO communication")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
Note that this targets net-next despite having a Fixes:-tag because the
is still only in net-next.

 drivers/net/dsa/mxl862xx/mxl862xx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mxl862xx/mxl862xx.c b/drivers/net/dsa/mxl862xx/mxl862xx.c
index 78eef639628a0..af9b00b2d2c43 100644
--- a/drivers/net/dsa/mxl862xx/mxl862xx.c
+++ b/drivers/net/dsa/mxl862xx/mxl862xx.c
@@ -407,6 +407,7 @@ static int mxl862xx_probe(struct mdio_device *mdiodev)
 	struct device *dev = &mdiodev->dev;
 	struct mxl862xx_priv *priv;
 	struct dsa_switch *ds;
+	int err;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -428,7 +429,11 @@ static int mxl862xx_probe(struct mdio_device *mdiodev)
 
 	dev_set_drvdata(dev, ds);
 
-	return dsa_register_switch(ds);
+	err = dsa_register_switch(ds);
+	if (err)
+		mxl862xx_host_shutdown(priv);
+
+	return err;
 }
 
 static void mxl862xx_remove(struct mdio_device *mdiodev)
-- 
2.53.0
Re: [PATCH net-next] net: dsa: mxl862xx: cancel pending work on probe error
Posted by Andrew Lunn 1 day, 7 hours ago
On Mon, Mar 30, 2026 at 11:52:09PM +0100, Daniel Golle wrote:
> Call mxl862xx_host_shutdown() in case dsa_register_switch() returns
> an error, so any still pending crc_err_work get canceled.
> 
> Fixes: a319d0c8c8ce ("net: dsa: mxl862xx: add CRC for MDIO communication")
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew