net: dsa: loop: Print when registration is successful
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 8 Jul 2020 04:45:13 +0000 (21:45 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Jul 2020 17:14:00 +0000 (10:14 -0700)
We have a number of error conditions that can lead to the driver not
probing successfully, move the print when we are sure
dsa_register_switch() has suceeded. This avoids repeated prints in case
of probe deferral for instance.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/dsa_loop.c

index 400207c..f8bc85a 100644 (file)
@@ -280,13 +280,11 @@ static int dsa_loop_drv_probe(struct mdio_device *mdiodev)
        struct dsa_loop_pdata *pdata = mdiodev->dev.platform_data;
        struct dsa_loop_priv *ps;
        struct dsa_switch *ds;
+       int ret;
 
        if (!pdata)
                return -ENODEV;
 
-       dev_info(&mdiodev->dev, "%s: 0x%0x\n",
-                pdata->name, pdata->enabled_ports);
-
        ds = devm_kzalloc(&mdiodev->dev, sizeof(*ds), GFP_KERNEL);
        if (!ds)
                return -ENOMEM;
@@ -311,7 +309,12 @@ static int dsa_loop_drv_probe(struct mdio_device *mdiodev)
 
        dev_set_drvdata(&mdiodev->dev, ds);
 
-       return dsa_register_switch(ds);
+       ret = dsa_register_switch(ds);
+       if (!ret)
+               dev_info(&mdiodev->dev, "%s: 0x%0x\n",
+                        pdata->name, pdata->enabled_ports);
+
+       return ret;
 }
 
 static void dsa_loop_drv_remove(struct mdio_device *mdiodev)