Is drive->id always set when ide_dma_check () gets called?
hi,
while trying to tackle some more coverity bugs, I came across bug #206 to #211. They are all about the function they register for hwif->ide_dma_check. Basically they all do something like
struct hd_driveid *id = drive->id
if (id && (id->capability & 1) && drive->autodma) {
something();
} else if ((id->capability & 8) || (id->field_valid & 2)) {
something_else();
}Coverity complains that id is only checked for != NULL in the first case but not the second. While trying to review the callers, all of them either checked drive->id or dereferenced it themselves. Only with probe_hwif() in drivers/ide/ide-probe.c I am not sure. So the question boils down
to: should we,
a) remove the check
b) add the check to the second case
c) just tell coverity to shut up
Thanks for comments,
Eric