aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-03-08 10:21:08 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-03-08 10:21:08 +0000
commit4e75ad23ad7c88e119735b787b782c9b8a9055f4 (patch)
tree6b5b34da958a5861c49369ccd2743b99c3d285ce /target
parent14fed3c49be007190c38598ccceddffb756ebe25 (diff)
downloadmaster-187ad058-4e75ad23ad7c88e119735b787b782c9b8a9055f4.tar.gz
master-187ad058-4e75ad23ad7c88e119735b787b782c9b8a9055f4.tar.bz2
master-187ad058-4e75ad23ad7c88e119735b787b782c9b8a9055f4.zip
generic: ar8216: simplify ar8216_config_init
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30853 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/files/drivers/net/phy/ar8216.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c
index 3b7937d72b..8e84e9d70a 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -892,34 +892,24 @@ ar8216_config_init(struct phy_device *pdev)
swdev->vlans = AR8216_NUM_VLANS;
}
- if ((ret = register_switch(&priv->dev, pdev->attached_dev)) < 0) {
- kfree(priv);
- goto done;
- }
+ ret = register_switch(&priv->dev, pdev->attached_dev);
+ if (ret)
+ goto err_free_priv;
priv->init = true;
- if (priv->chip == AR8316) {
+ ret = 0;
+ if (priv->chip == AR8236)
+ ret = ar8236_hw_init(priv);
+ else if (priv->chip == AR8316)
ret = ar8316_hw_init(priv);
- if (ret) {
- kfree(priv);
- goto done;
- }
- }
- if (priv->chip == AR8236) {
- ret = ar8236_hw_init(priv);
- if (ret) {
- kfree(priv);
- goto done;
- }
- }
+ if (ret)
+ goto err_free_priv;
ret = ar8216_reset_switch(&priv->dev);
- if (ret) {
- kfree(priv);
- goto done;
- }
+ if (ret)
+ goto err_free_priv;
dev->phy_ptr = priv;
@@ -936,7 +926,10 @@ ar8216_config_init(struct phy_device *pdev)
priv->init = false;
-done:
+ return 0;
+
+err_free_priv:
+ kfree(priv);
return ret;
}