]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: Relax error checking on sysfs_create_link()
authorFlorian Fainelli <f.fainelli@gmail.com>
Sat, 27 May 2017 17:42:25 +0000 (10:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 27 May 2017 23:58:15 +0000 (19:58 -0400)
commitff90d2c75cd6dbb9e3071734d23395b3502a283a
tree313b863d836c17e3ff8ffdcf12bde15576b2f6bd
parentc884862c92e85df5b828ef120c19f6bf2645ef6c
net: phy: Relax error checking on sysfs_create_link()

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: 1d1120795332 ("net: phy: Create sysfs reciprocal links for attached_dev/phydev")
Reported-by: Woojung Hung <Woojung.Huh@microchip.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy_device.c
include/linux/phy.h