From 4e8405857aa291e15b06520558f3c1a015e974dc Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Sun, 19 Jul 2015 20:44:56 +0200 Subject: [PATCH] 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. --- .../drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c index 1ef2372..1fc1cc2 100644 --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c @@ -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");