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); _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"