ag71xx_ar7240/export_netdevs: check if the phy is already checked early

Don't create a netdev for phy which are already attached to a netdev.
This replace kernel errors:

(null): PHY already attached
phy attach failed 4 with err -16

With:
Phy on addr 0x4 is already attached. Not creating a phy device for it.
This commit is contained in:
Alexander Couzens 2015-07-19 20:44:56 +02:00
parent cb5ddd5168
commit 4e8405857a
1 changed files with 5 additions and 0 deletions

View File

@ -1032,6 +1032,11 @@ ar7240_set_export_netdevs(struct switch_dev *dev, const struct switch_attr *attr
if (!phy)
continue;
if (phy->attached_dev) {
printk(KERN_INFO "Switch: Phy on addr 0x%x is already attached. Not creating a phy device for it.\n", phy->addr);
continue;
}
netdev = alloc_netdev_mqs(sizeof(struct priv_netdev_port), "phy%d", ether_setup, 1, 1);
if (!netdev) {
printk(KERN_ERR "can not allow netdev\n");