mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
ide: fix buggy code in ide_register_hw()
Relocating the index to come after finding the hwif pointer. Signed-off-by: Peter Teoh <htmldeveloper@gmail.com> Reported-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
parent
ef4298d0f0
commit
0c6025d444
1 changed files with 1 additions and 1 deletions
|
@ -667,7 +667,6 @@ int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *),
|
|||
|
||||
do {
|
||||
hwif = ide_deprecated_find_port(hw->io_ports[IDE_DATA_OFFSET]);
|
||||
index = hwif->index;
|
||||
if (hwif)
|
||||
goto found;
|
||||
for (index = 0; index < MAX_HWIFS; index++)
|
||||
|
@ -675,6 +674,7 @@ int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *),
|
|||
} while (retry--);
|
||||
return -1;
|
||||
found:
|
||||
index = hwif->index;
|
||||
if (hwif->present)
|
||||
ide_unregister(index, 0, 1);
|
||||
else if (!hwif->hold)
|
||||
|
|
Loading…
Reference in a new issue