linux/drivers
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
..
accessibility
acpi acpi: Remove sysfs_create_link from video driver 2011-03-28 13:05:29 -07:00
amba
ata drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
atm
auxdisplay
base
block drbd: fix up merge error 2011-03-28 07:42:58 -07:00
bluetooth
cdrom
char char/tpm: Fix unitialized usage of data buffer 2011-03-29 09:45:34 -07:00
clk
clocksource
connector
cpufreq
cpuidle
crypto
dca
dio
dma Merge branch 'irq-cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2011-03-27 20:58:56 -07:00
edac amd64_edac: Fix potential memleak 2011-03-29 18:19:06 +02:00
eisa
firewire
firmware
gpio gpio: ab8500: Mark broken 2011-03-29 14:50:42 +02:00
gpu
hid
hwmon drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
hwspinlock
i2c
ide
idle
ieee802154
infiniband
input drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
isdn
leds
lguest
macintosh
mca
md md: Fix integrity registration error when no devices are capable 2011-03-28 17:53:29 -07:00
media
memstick memstick: make enable_dma less generic in r592 2011-03-28 16:24:29 -07:00
message
mfd Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc 2011-03-29 12:09:30 -07:00
misc drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
mmc Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc 2011-03-29 12:09:30 -07:00
mtd
net phylib: phy_attach_direct: phy_init_hw can fail, add cleanup 2011-03-30 02:31:36 -07:00
nfc
nubus
of
oprofile
parisc parisc: Convert irq namespace 2011-03-29 14:48:08 +02:00
parport
pci drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
pcmcia drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
platform drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
pnp
power drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
pps
ps3
rapidio
regulator regulator: Add MODULE_DEVICE_TABLE to max8997 and max8998 2011-03-27 11:47:25 +01:00
rtc drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
s390
sbus
scsi
sfi
sh sh: Convert to new function names 2011-03-29 14:48:13 +02:00
sn
spi
ssb
staging drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
target
tc
telephony
thermal
tty drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
uio
usb drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
uwb
vhost
video
virtio
vlynq vlynq: Convert irq functions 2011-03-28 19:33:04 +02:00
w1 drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
watchdog watchdog: softdog.c: enhancement to optionally invoke panic instead of reboot on timer expiry 2011-03-29 11:56:22 +00:00
xen xen: Use new irq_move functions 2011-03-29 10:01:05 -04:00
zorro
Kconfig
Makefile