RTL8139: Do not register driver if reset failed.

git-svn-id: svn://kolibrios.org@6682 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2016-11-06 17:59:28 +00:00
parent d6e2af9385
commit b1100a5fe6

View File

@ -370,10 +370,11 @@ proc service_proc stdcall, ioctl:dword
ret
; If an error occured, remove all allocated data and exit (returning -1 in eax)
.destroy:
; todo: unregister device from device_list
; todo: reset device into virgin state
; unregister device from device_list
mov eax, [devices]
mov dword[device_list-4+4*eax], 0
dec [devices]
.err:
DEBUGF 2, "Error, removing all data !\n"
@ -508,17 +509,6 @@ probe:
reset:
DEBUGF 1, "Reset\n"
; attach int handler
movzx eax, [ebx + device.irq_line]
DEBUGF 1, "Attaching int handler to irq %x\n", eax:1
invoke AttachIntHandler, eax, int_handler, ebx
test eax, eax
jnz @f
DEBUGF 2, "Could not attach int handler!\n"
or eax, -1
ret
@@:
; reset chip
DEBUGF 1, "Resetting chip\n"
set_io [ebx + device.io_addr], 0
@ -533,11 +523,24 @@ reset:
dec cx
jns .wait_for_reset
DEBUGF 2, "Reset timeout!\n"
or eax, -1
ret
.reset_completed:
; Read MAC address
call read_mac
; attach int handler
movzx eax, [ebx + device.irq_line]
DEBUGF 1, "Attaching int handler to irq %x\n", eax:1
invoke AttachIntHandler, eax, int_handler, ebx
test eax, eax
jnz @f
DEBUGF 2, "Could not attach int handler!\n"
or eax, -1
ret
@@:
; unlock config and BMCR registers
set_io [ebx + device.io_addr], 0
set_io [ebx + device.io_addr], REG_9346CR