summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorPeter Teoh <htmldeveloper@gmail.com>2008-03-07 21:53:49 +0100
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-03-07 21:53:49 +0100
commit0c6025d44448bd688dfd351a09bc620aafa4d1ff (patch)
treefb6336469c21789cba0a84c4ebfe5db69e8d25bf /drivers
parentef4298d0f06c788d204caa9e395de6e9e2fd9fc9 (diff)
downloadlinux-3.10-0c6025d44448bd688dfd351a09bc620aafa4d1ff.tar.gz
linux-3.10-0c6025d44448bd688dfd351a09bc620aafa4d1ff.tar.bz2
linux-3.10-0c6025d44448bd688dfd351a09bc620aafa4d1ff.zip
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index fa16bc30bbc..c2b79122409 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -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)