Skip to content

Commit 1375320

Browse files
committed
[FREELDR] pc98disk.c: Simplify disk read checks in loops
1 parent 10b7a85 commit 1375320

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

boot/freeldr/freeldr/arch/i386/pc98/pc98disk.c

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ Pc98DiskReadLogicalSectorsLBA(
210210
RegsIn.w.bp = ((ULONG_PTR)Buffer) & 0x0F;
211211

212212
/* Retry 3 times */
213-
for (RetryCount = 0; RetryCount < 3; RetryCount++)
213+
for (RetryCount = 0; RetryCount < 3; ++RetryCount)
214214
{
215215
Int386(0x1B, &RegsIn, &RegsOut);
216216

@@ -341,26 +341,17 @@ Pc98DiskReadLogicalSectorsCHS(
341341
}
342342

343343
/* Perform the read. Retry 3 times. */
344-
for (RetryCount = 0; RetryCount < 3; RetryCount++)
344+
for (RetryCount = 0; RetryCount < 3; ++RetryCount)
345345
{
346346
Int386(0x1B, &RegsIn, &RegsOut);
347347

348-
/* If it worked break out */
349-
if (INT386_SUCCESS(RegsOut))
350-
{
351-
break;
352-
}
353-
/* If it was a corrected ECC error then the data is still good */
354-
else if (RegsOut.b.ah == 0x08)
355-
{
348+
/* If it worked, or if it was a corrected ECC error
349+
* and the data is still good, return success */
350+
if (INT386_SUCCESS(RegsOut) || (RegsOut.b.ah == 0x08))
356351
break;
357-
}
358-
/* If it failed then do the next retry */
359-
else
360-
{
361-
DiskResetController(DiskDrive);
362-
continue;
363-
}
352+
353+
/* It failed, do the next retry */
354+
DiskResetController(DiskDrive);
364355
}
365356

366357
/* If we retried 3 times then fail */

0 commit comments

Comments
 (0)