• Florian Fainelli's avatar
    net: phy: Relax error checking on sysfs_create_link() · a3995460
    Florian Fainelli authored
    Some Ethernet drivers will attach/connect to a PHY device before calling
    register_netdevice() which is responsible for calling netdev_register_kobject()
    which would do the network device's kobject initialization. In such a case,
    sysfs_create_link() would return -ENOENT because the network device's kobject
    is not ready yet, and we would fail to connect to the PHY device.
    
    In order to keep things simple and symetrical, we just take the success path as
    indicative of the ability to access the network device's kobject, and create
    the second link if that's the case.
    
    Fixes: 5568363f ("net: phy: Create sysfs reciprocal links for attached_dev/phydev")
    Reported-by: default avatarWoojung Hung <Woojung.Huh@microchip.com>
    Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    a3995460
phy_device.c 48.2 KB