Re: [PATCH 8/15] ide: disable DMA in ->ide_dma_check for "no IORDY"case

From: Sergei Shtylyov
Date: Thu Jan 25 2007 - 12:03:50 EST


Hello.

Bartlomiej Zolnierkiewicz wrote:

The other advantage of doing cleanups is that code becomes cleaner/simpler
which matters a lot for this codebase, i.e. ide-dma-off-void.patch exposed
(yet to be fixed) bug in set_using_dma() (->ide_dma_off_quietly always returns
0 which is passed by ->ide_dma_check to set_using_dma() which incorrectly
then calls ->ide_dma_on).

Well, this seems a newly intruduced bug.

The old code is so convulted that it is hard to see it w/o cleanup. :)

->ide_dma_check implementations often do

return hwif->ide_dma_off_quietly(drive);

so the return value of ide_dma_off_quietly() (which is always 0) is passed to

if (HWIF(drive)->ide_dma_check(drive)) return -EIO;

in ide.c:set_using_dma() -> as a result the next line is executed

if (HWIF(drive)->ide_dma_on(drive)) return -EIO;

So, the error seems to call hwif->ide_dma_on() after hwif->ide_dma_check() since hwif->ide_dma_check() must've already called that.

MBR, Sergei
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/