lkml.org 
[lkml]   [1999]   [Jan]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectide-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/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.061 / U:1.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site