提交 0c6025d4 编写于 作者: tthtlc's avatar tthtlc 提交者: Bartlomiej Zolnierkiewicz

ide: fix buggy code in ide_register_hw()

Relocating the index to come after finding the hwif pointer.
Signed-off-by: tthtlc's avatarPeter Teoh <htmldeveloper@gmail.com>
Reported-by: NAdrian Bunk <bunk@kernel.org>
Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
上级 ef4298d0
...@@ -667,7 +667,6 @@ int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *), ...@@ -667,7 +667,6 @@ int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *),
do { do {
hwif = ide_deprecated_find_port(hw->io_ports[IDE_DATA_OFFSET]); hwif = ide_deprecated_find_port(hw->io_ports[IDE_DATA_OFFSET]);
index = hwif->index;
if (hwif) if (hwif)
goto found; goto found;
for (index = 0; index < MAX_HWIFS; index++) for (index = 0; index < MAX_HWIFS; index++)
...@@ -675,6 +674,7 @@ int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *), ...@@ -675,6 +674,7 @@ int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *),
} while (retry--); } while (retry--);
return -1; return -1;
found: found:
index = hwif->index;
if (hwif->present) if (hwif->present)
ide_unregister(index, 0, 1); ide_unregister(index, 0, 1);
else if (!hwif->hold) else if (!hwif->hold)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册