generic: ar8216: don't probe the chip multiple times
authorGabor Juhos <juhosg@openwrt.org>
Sun, 10 Feb 2013 13:05:15 +0000 (13:05 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sun, 10 Feb 2013 13:05:15 +0000 (13:05 +0000)
It is only needed when the private data is allocated.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 35538

target/linux/generic/files/drivers/net/phy/ar8216.c

index f356eafe5dd42fc190cc439d2e70f1108c6c3658..ec6d232668aa9f55a5f1d57b8f702c6a736f45ee 100644 (file)
@@ -1780,17 +1780,17 @@ ar8216_config_init(struct phy_device *pdev)
                priv = kzalloc(sizeof(struct ar8216_priv), GFP_KERNEL);
                if (priv == NULL)
                        return -ENOMEM;
-       }
 
-       priv->mii_bus = pdev->bus;
-       priv->read = ar8216_mii_read;
-       priv->write = ar8216_mii_write;
+               priv->mii_bus = pdev->bus;
+               priv->read = ar8216_mii_read;
+               priv->write = ar8216_mii_write;
 
-       priv->phy = pdev;
+               ret = ar8216_id_chip(priv);
+               if (ret)
+                       goto err_free_priv;
+       }
 
-       ret = ar8216_id_chip(priv);
-       if (ret)
-               goto err_free_priv;
+       priv->phy = pdev;
 
        if (ar8xxx_has_gige(priv))
                pdev->supported = SUPPORTED_1000baseT_Full;