Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c6025d4 authored by Peter Teoh's avatar Peter Teoh Committed by Bartlomiej Zolnierkiewicz
Browse files

ide: fix buggy code in ide_register_hw()



Relocating the index to come after finding the hwif pointer.

Signed-off-by: default avatarPeter Teoh <htmldeveloper@gmail.com>
Reported-by: default avatarAdrian Bunk <bunk@kernel.org>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent ef4298d0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)