aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 0d7328e0fb96..8ef521f66f87 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -694,6 +694,15 @@ int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *),
694 int index, retry = 1; 694 int index, retry = 1;
695 ide_hwif_t *hwif; 695 ide_hwif_t *hwif;
696 696
697 if (initializing) {
698 hwif = ide_find_port(hw->io_ports[IDE_DATA_OFFSET]);
699 if (hwif) {
700 index = hwif->index;
701 goto found;
702 }
703 return -1;
704 }
705
697 do { 706 do {
698 for (index = 0; index < MAX_HWIFS; ++index) { 707 for (index = 0; index < MAX_HWIFS; ++index) {
699 hwif = &ide_hwifs[index]; 708 hwif = &ide_hwifs[index];
@@ -704,8 +713,7 @@ int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *),
704 hwif = &ide_hwifs[index]; 713 hwif = &ide_hwifs[index];
705 if (hwif->hold) 714 if (hwif->hold)
706 continue; 715 continue;
707 if ((!hwif->present && !hwif->mate && !initializing) || 716 if (!hwif->present && hwif->mate == NULL)
708 (!hwif->io_ports[IDE_DATA_OFFSET] && initializing))
709 goto found; 717 goto found;
710 } 718 }
711 for (index = 0; index < MAX_HWIFS; index++) 719 for (index = 0; index < MAX_HWIFS; index++)