Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Dec 2018 17:17:53 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r342193 - head/sys/dev/ichwd
Message-ID:  <201812181717.wBIHHr8D040159@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Tue Dec 18 17:17:53 2018
New Revision: 342193
URL: https://svnweb.freebsd.org/changeset/base/342193

Log:
  ichwd: add a few assertions about tco_version
  
  Those should ensure correctness of ichwd_find_ich_lpc_bridge() and
  ichwd_find_ich_lpc_bridge() as well as make it easier for both humans
  and static analyzers to see the relation between tco_version and ich and
  smb variables in ichwd_identify().
  
  Reported by:	Coverity
  CID:		1396314, 1396317
  MFC after:	10 days

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

Modified: head/sys/dev/ichwd/ichwd.c
==============================================================================
--- head/sys/dev/ichwd/ichwd.c	Tue Dec 18 16:47:03 2018	(r342192)
+++ head/sys/dev/ichwd/ichwd.c	Tue Dec 18 17:17:53 2018	(r342193)
@@ -635,6 +635,13 @@ ichwd_identify(driver_t *driver, device_t parent)
 			return;
 	}
 
+	KASSERT(id_p->tco_version >= 1,
+	    ("unexpected TCO version %d", id_p->tco_version));
+	KASSERT(id_p->tco_version != 4 || smb != NULL,
+	    ("could not find PCI SMBus device for TCOv4"));
+	KASSERT(id_p->tco_version >= 4 || ich != NULL,
+	    ("could not find PCI LPC bridge device for TCOv1-3"));
+
 	/* good, add child to bus */
 	if ((dev = device_find_child(parent, driver->name, 0)) == NULL)
 		dev = BUS_ADD_CHILD(parent, 0, driver->name, 0);



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