Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Sep 2020 13:56:47 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r365299 - stable/12/sys/dev/asmc
Message-ID:  <202009031356.083DulXf035909@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Thu Sep  3 13:56:47 2020
New Revision: 365299
URL: https://svnweb.freebsd.org/changeset/base/365299

Log:
  MFC r364871:
  asmc(4): Handle errors from asmc_key_read() properly.
  
  PR:	248939

Modified:
  stable/12/sys/dev/asmc/asmc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/asmc/asmc.c
==============================================================================
--- stable/12/sys/dev/asmc/asmc.c	Thu Sep  3 13:56:30 2020	(r365298)
+++ stable/12/sys/dev/asmc/asmc.c	Thu Sep  3 13:56:47 2020	(r365299)
@@ -1062,7 +1062,7 @@ asmc_fan_count(device_t dev)
 {
 	uint8_t buf[1];
 
-	if (asmc_key_read(dev, ASMC_KEY_FANCOUNT, buf, sizeof buf) < 0)
+	if (asmc_key_read(dev, ASMC_KEY_FANCOUNT, buf, sizeof buf) != 0)
 		return (-1);
 
 	return (buf[0]);
@@ -1076,7 +1076,7 @@ asmc_fan_getvalue(device_t dev, const char *key, int f
 	char fankey[5];
 
 	snprintf(fankey, sizeof(fankey), key, fan);
-	if (asmc_key_read(dev, fankey, buf, sizeof buf) < 0)
+	if (asmc_key_read(dev, fankey, buf, sizeof buf) != 0)
 		return (-1);
 	speed = (buf[0] << 6) | (buf[1] >> 2);
 
@@ -1090,7 +1090,7 @@ asmc_fan_getstring(device_t dev, const char *key, int 
 	char* desc;
 
 	snprintf(fankey, sizeof(fankey), key, fan);
-	if (asmc_key_read(dev, fankey, buf, buflen) < 0)
+	if (asmc_key_read(dev, fankey, buf, buflen) != 0)
 		return (NULL);
 	desc = buf+4;
 
@@ -1229,7 +1229,7 @@ asmc_temp_getvalue(device_t dev, const char *key)
 	/*
 	 * Check for invalid temperatures.
 	 */
-	if (asmc_key_read(dev, key, buf, sizeof buf) < 0)
+	if (asmc_key_read(dev, key, buf, sizeof buf) != 0)
 		return (-1);
 
 	return (buf[0]);



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