[PATCH] 2.4.19-rc5 IDE kernel option breakage

Mikael Pettersson (mikpe@csd.uu.se)
Thu, 1 Aug 2002 18:39:47 +0200 (MET DST)


When CONFIG_BLK_DEV_IDEPCI is disabled, using a kernel option
to activate a non-PCI IDE chipset on x86 (e.g. via "ide0=qd65xx")
fails with a "-- BAD OPTION" error from ide_setup().

This is because include/asm-i386/ide.h:ide_init_default_hwifs()
passes a partially uninitialised variable "hw" to
drivers/ide/ide.c:ide_register_hw(), which in turn copies it,
including the unitialised fields, to a hwif. In particular,
ide_init_default_hwifs() puts random junk in hwif->chipset.
ide_setup() later believes that a chipset already has been selected
(line 3434), so it rejects any chipset-selection kernel option.

This does not happen when CONFIG_BLK_DEV_IDEPCI=y because in that
case ide_init_default_hwifs() doesn't call ide_register_hw(),
and consequently doesn't put junk in hwif->chipset.

A minimal fix (included below) is to clear hw before setting it
up and passing it to ide_register_hw().

/Mikael

--- linux-2.4.19-rc5/include/asm-i386/ide.h.~1~ Thu Aug 1 14:49:03 2002
+++ linux-2.4.19-rc5/include/asm-i386/ide.h Thu Aug 1 15:05:20 2002
@@ -79,6 +79,7 @@
int index;

for(index = 0; index < MAX_HWIFS; index++) {
+ memset(&hw, 0, sizeof hw);
ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
hw.irq = ide_default_irq(ide_default_io_base(index));
ide_register_hw(&hw, NULL);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/