ramips: mtd_eth_soc: use dev_err_probe
authorRosen Penev <rosenp@gmail.com>
Thu, 15 Aug 2024 02:25:21 +0000 (19:25 -0700)
committerChuanhong Guo <gch981213@gmail.com>
Tue, 17 Sep 2024 13:45:17 +0000 (21:45 +0800)
Simplifies the code by avoiding having to manually handle -EPROBE_DEFER.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c

index e261d90924db42f33684e4782bb468bde998a1d9..c7e074aaa5d9e27701300366bd3e33cd4b6e0f4b 100644 (file)
@@ -1354,13 +1354,8 @@ static int __init fe_init(struct net_device *dev)
 
        if (priv->soc->switch_init) {
                err = priv->soc->switch_init(priv);
-               if (err) {
-                       if (err == -EPROBE_DEFER)
-                               return err;
-
-                       netdev_err(dev, "failed to initialize switch core\n");
-                       return -ENODEV;
-               }
+               if (err)
+                       return dev_err_probe(&dev->dev, err, "failed to initialize switch core");
        }
 
        fe_reset_phy(priv);