Messages in this thread | | | Date | Fri, 22 Jan 1999 09:46:52 +0000 | From | Edmund GRIMLEY EVANS <> | Subject | ide-probe.c logic wrong? |
| |
I discovered the hard way that strstr() was broken in pre8, so I suppose my LS-120 drive will work again with pre9, but I still think this bit of code in ide-probe.c is wrong:
switch (type) { case ide_floppy: if (!strstr(id->model, "CD-ROM")) { if (!strstr(id->model, "oppy") && !strstr(id->model, "poyp") && !strstr(id->model, "ZIP")) printk("cdrom or floppy?, assuming "); if (drive->media != ide_cdrom) { printk ("FLOPPY"); break; } } type = ide_cdrom; /* Early cdrom models used zero */ case ide_cdrom:
Suppose drive->media is equal to ide_cdrom.
Suppose id->model contains none of the substrings mentioned.
Then the code prints "... assuming " and sets the type to ide_cdrom.
Now suppose id->model contains "oppy" but none of the other substrings.
Then the code DOESN'T print "... assuming ", but it STILL sets the type to ide_cdrom.
This doesn't make sense!
Here is what I suspect was intended:
switch (type) { case ide_floppy: if (strstr(id->model, "CD-ROM")) goto cdrom; if (!strstr(id->model, "oppy") && !strstr(id->model, "poyp") && !strstr(id->model, "ZIP")) { printk("cdrom or floppy?, assuming "); if (drive->media == ide_cdrom) goto cdrom; } printk ("FLOPPY"); break; cdrom: type = ide_cdrom; /* Early cdrom models used zero */ case ide_cdrom:
Edmund
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |