ATA init: Only need to clear shadowdevhead if no drive was found.

This commit is contained in:
Matt Harlum 2023-09-06 19:02:26 +00:00
parent 9bb39e8462
commit 25c145c3e1
2 changed files with 3 additions and 4 deletions

4
ata.c
View File

@ -207,12 +207,10 @@ bool ata_init_unit(struct IDEUnit *unit) {
}
if (dev_found == false || !ata_wait_not_busy(unit,ATA_BSY_WAIT_COUNT)) {
*unit->shadowDevHead = 0;
return false;
}
if ((buf = AllocMem(512,MEMF_ANY|MEMF_CLEAR)) == NULL) { // Allocate buffer for IDENTIFY result
*unit->shadowDevHead = 0;
return false;
}
@ -266,7 +264,6 @@ ident_failed:
Warn("INIT: IDENTIFY failed\n");
// Command failed with a timeout or error
FreeMem(buf,512);
*unit->shadowDevHead = 0;
return false;
}
}
@ -274,7 +271,6 @@ ident_failed:
if (unit->atapi == false && unit->blockSize == 0) {
Warn("INIT: Error! blockSize is 0\n");
if (buf) FreeMem(buf,512);
*unit->shadowDevHead = 0;
return false;
}

View File

@ -308,6 +308,9 @@ struct Library __attribute__((used, saveds)) * init_device(struct ExecBase *SysB
if (ata_init_unit(&dev->units[i])) {
dev->num_units++;
} else {
// Clear this to skip the pre-select BSY wait later
*dev->units[i].shadowDevHead = 0;
}
}