1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-01-12 01:10:15 +02:00

generic: ar8216: simplify ar8216_config_init

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30853 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2012-03-08 10:21:08 +00:00
parent c9de293cbb
commit 1130aa078f

View File

@ -892,34 +892,24 @@ ar8216_config_init(struct phy_device *pdev)
swdev->vlans = AR8216_NUM_VLANS; swdev->vlans = AR8216_NUM_VLANS;
} }
if ((ret = register_switch(&priv->dev, pdev->attached_dev)) < 0) { ret = register_switch(&priv->dev, pdev->attached_dev);
kfree(priv); if (ret)
goto done; goto err_free_priv;
}
priv->init = true; priv->init = true;
if (priv->chip == AR8316) { ret = 0;
ret = ar8316_hw_init(priv); if (priv->chip == AR8236)
if (ret) {
kfree(priv);
goto done;
}
}
if (priv->chip == AR8236) {
ret = ar8236_hw_init(priv); ret = ar8236_hw_init(priv);
if (ret) { else if (priv->chip == AR8316)
kfree(priv); ret = ar8316_hw_init(priv);
goto done;
} if (ret)
} goto err_free_priv;
ret = ar8216_reset_switch(&priv->dev); ret = ar8216_reset_switch(&priv->dev);
if (ret) { if (ret)
kfree(priv); goto err_free_priv;
goto done;
}
dev->phy_ptr = priv; dev->phy_ptr = priv;
@ -936,7 +926,10 @@ ar8216_config_init(struct phy_device *pdev)
priv->init = false; priv->init = false;
done: return 0;
err_free_priv:
kfree(priv);
return ret; return ret;
} }