linux/drivers/net/phy
Marc Kleine-Budde d005a09edf phylib: phy_attach_direct: phy_init_hw can fail, add cleanup
The function phy_attach_direct attaches the phy and calls phy_init_hw.
phy_init_hw can fail, but the phy is still marked as attached. Successive
calls to phy_attach_direct will fail because the phy is busy.

[    1.020000] eth0: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=1:00, irq=-1)
[    1.030000] eth1: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=1:01, irq=-1)
[    2.050000] Sending DHCP requests .
[    3.020000] PHY: 1:00 - Link is Up - 100/Full
[    5.110000] ..... timed out!
[   87.660000] IP-Config: Reopening network devices...
[   88.190000] FEC: MDIO read timeout
[   88.190000] eth0: could not attach to PHY
[   88.190000] IP-Config: Failed to open eth0
[   88.210000] FEC: MDIO read timeout
[   88.210000] eth1: could not attach to PHY
[   88.210000] IP-Config: Failed to open eth1
[   88.220000] IP-Config: No network devices available.
[   88.220000] Freeing init memory: 6968K

[...]

starting network interfaces...
ip: RTNETLINK answers: File exists
[   94.000000] net eth0: PHY already attached
[   94.010000] eth0: could not attach to PHY
ip: SIOCSIFFLAGS: Device or resource busy

This patch adds phy_detach to clean up if phy_init_hw fails.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-03-30 02:31:36 -07:00
..
bcm63xx.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
broadcom.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
cicada.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
davicom.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
et1011c.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
fixed.c
icplus.c phy: add the IC+ IP1001 driver 2010-12-10 15:48:43 -08:00
Kconfig phy: Remove unneeded depends on PHYLIB 2011-02-11 22:01:08 -08:00
lxt.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
Makefile
marvell.c of/phylib: Use device tree properties to initialize Marvell PHYs. 2010-11-22 08:34:23 -08:00
mdio-bitbang.c
mdio-gpio.c dt/net: Eliminate users of of_platform_{,un}register_driver 2011-02-28 13:22:44 -07:00
mdio-octeon.c netdev: mdio-octeon: Fix section mismatch errors. 2010-06-28 23:58:54 -07:00
mdio_bus.c phylib: fix PAL state machine restart on resume 2010-09-14 14:31:03 -07:00
micrel.c phy/micrel: add ability to support 50MHz RMII clock on KZS8051RNL 2011-02-14 17:38:30 -08:00
national.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
phy.c phylib: SIOCGMIIREG/SIOCSMIIREG: allow access to all mdio addresses 2011-03-14 15:02:14 -07:00
phy_device.c phylib: phy_attach_direct: phy_init_hw can fail, add cleanup 2011-03-30 02:31:36 -07:00
qsemi.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
realtek.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
smsc.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
ste10Xp.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
vitesse.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00