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>

authored by Peter Teoh and committed by Bartlomiej Zolnierkiewicz 0c6025d4 ef4298d0

+1 -1
+1 -1
drivers/ide/ide.c
··· 667 667 668 668 do { 669 669 hwif = ide_deprecated_find_port(hw->io_ports[IDE_DATA_OFFSET]); 670 - index = hwif->index; 671 670 if (hwif) 672 671 goto found; 673 672 for (index = 0; index < MAX_HWIFS; index++) ··· 674 675 } while (retry--); 675 676 return -1; 676 677 found: 678 + index = hwif->index; 677 679 if (hwif->present) 678 680 ide_unregister(index, 0, 1); 679 681 else if (!hwif->hold)