generic: ar8216: use dynamically allocated private data in ar8216_probe
[openwrt.git] / target / linux / generic / files / drivers / net / phy / ar8216.c
index 4df2dbb..5a8a938 100644 (file)
@@ -1481,10 +1481,19 @@ ar8216_config_aneg(struct phy_device *phydev)
 static int
 ar8216_probe(struct phy_device *pdev)
 {
-       struct ar8216_priv priv;
+       struct ar8216_priv *priv;
+       int ret;
+
+       priv = kzalloc(sizeof(struct ar8216_priv), GFP_KERNEL);
+       if (priv == NULL)
+               return -ENOMEM;
+
+       priv->phy = pdev;
 
-       priv.phy = pdev;
-       return ar8216_id_chip(&priv);
+       ret = ar8216_id_chip(priv);
+       kfree(priv);
+
+       return ret;
 }
 
 static void