From b3cb04b930b9b7334868b25cd245341489474481 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Thu, 27 Aug 2020 16:34:33 +0000 Subject: [PATCH] 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 MFC after: 1 week --- sys/dev/fdc/fdc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 424ae339536b..11262231c3b2 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -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)