Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Aug 2020 16:34:34 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r364872 - head/sys/dev/fdc
Message-ID:  <202008271634.07RGYYl7033390@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Thu Aug 27 16:34:33 2020
New Revision: 364872
URL: https://svnweb.freebsd.org/changeset/base/364872

Log:
  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

Modified:
  head/sys/dev/fdc/fdc.c

Modified: head/sys/dev/fdc/fdc.c
==============================================================================
--- head/sys/dev/fdc/fdc.c	Thu Aug 27 16:34:20 2020	(r364871)
+++ head/sys/dev/fdc/fdc.c	Thu Aug 27 16:34:33 2020	(r364872)
@@ -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 *cy
 		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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008271634.07RGYYl7033390>