It appears that by line 24 of that function, the device has been
queried for some sort of status information, and it is expected to
return some sort of message with a known, fixed format. The number of
words that the device is going to return has been read into the
variable "word_count". What follows is five sections of code of
approximately the form:
if (word_count--) {
WAIT_FOR_STATUS;
stat_word = inw(ESDI_STT_INT);
printk(KERN_ERR "---formatting depends on section---\n",
stat_word);
}
It looks like the code is counting down the variable word_count to
avoid attempting to read and print words from the device that the
device has not supplied.
But if this is so, the code is erroneous, because although when
word_count reaches 0, the next section of code will be skipped, the
"--" will decrement word_count to -1, which will test true in the next
if, and cause that section of code to execute. What is needed is that
when word_count reaches 0, all following sections are skipped. One
way to achieve this would be to reformat the sections into the form:
if (word_count-- == 0)
goto done;
WAIT_FOR_STATUS;
stat_word = inw(ESDI_STT_INT);
printk(KERN_ERR "---formatting depends on section---\n",
stat_word);
and insert a label "done: ;" at the end of the function.
Dale
-- Dale R. Worley Ariadne Internet Services Voice: +1 617-899-7949 Fax: +1 617-899-7946 E-mail: worley@ariadne.com "Internet-based electronic commerce solutions to real business problems."