fdc(4): Handle errors from fdc_in() properly.

fdc_in() returns only 0 and 1, some callers were checking incorrectly
for failure.

PR:		248940
Submitted by:	Tong Zhang <ztong0001@gmail.com>
MFC after:	1 week
This commit is contained in:
Mark Johnston 2020-08-27 16:34:33 +00:00
parent 9c325393d5
commit b3cb04b930

View File

@ -492,7 +492,7 @@ fdc_cmd(struct fdc_data *fdc, int n_out, ...)
n_in = va_arg(ap, int);
for (n = 0; n < n_in; n++) {
int *ptr = va_arg(ap, int *);
if (fdc_in(fdc, ptr) < 0) {
if (fdc_in(fdc, ptr) != 0) {
char msg[50];
snprintf(msg, sizeof(msg),
"cmd %02x failed at in byte %d of %d\n",
@ -587,7 +587,7 @@ fdc_sense_int(struct fdc_data *fdc, int *st0p, int *cylp)
return (FD_NOT_VALID);
}
if (fdc_in(fdc, &cyl) < 0)
if (fdc_in(fdc, &cyl) != 0)
return fdc_err(fdc, "can't get cyl num\n");
if (cylp)