Signed-off-by: Peter Teoh --- drivers/ide/ide.c.orig 2008-03-04 08:26:11.000000000 +0800 +++ drivers/ide/ide.c 2008-03-04 09:07:44.000000000 +0800 @@ -667,7 +667,6 @@ int ide_register_hw(hw_regs_t *hw, void 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 } while (retry--); return -1; found: + index = hwif->index; if (hwif->present) ide_unregister(index, 0, 1); else if (!hwif->hold)