From owner-svn-src-stable@freebsd.org Thu Mar 15 05:04:47 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49CD2F4C746; Thu, 15 Mar 2018 05:04:47 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF2246C192; Thu, 15 Mar 2018 05:04:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB91211D9D; Thu, 15 Mar 2018 05:04:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2F54kr2022961; Thu, 15 Mar 2018 05:04:46 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2F54ks2022958; Thu, 15 Mar 2018 05:04:46 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803150504.w2F54ks2022958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Thu, 15 Mar 2018 05:04:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r330968 - in stable/11/usr.sbin: ifmcstat pciconf X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/usr.sbin: ifmcstat pciconf X-SVN-Commit-Revision: 330968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Mar 2018 05:04:47 -0000 Author: eadler Date: Thu Mar 15 05:04:46 2018 New Revision: 330968 URL: https://svnweb.freebsd.org/changeset/base/330968 Log: MFC r327580,r327581: bits is never null when we call ot. Add an assert to that effect and remove test for NULL. Remove dead code (comma is either 0 or 1 for sure, no need to test). Close /dev/pci when we're done with it. Modified: stable/11/usr.sbin/ifmcstat/printb.c stable/11/usr.sbin/pciconf/cap.c stable/11/usr.sbin/pciconf/pciconf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/ifmcstat/printb.c ============================================================================== --- stable/11/usr.sbin/ifmcstat/printb.c Thu Mar 15 04:59:47 2018 (r330967) +++ stable/11/usr.sbin/ifmcstat/printb.c Thu Mar 15 05:04:46 2018 (r330968) @@ -32,6 +32,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include /* @@ -43,7 +44,8 @@ printb(const char *s, unsigned int v, const char *bits int i, any = 0; char c; - if (bits && *bits == 8) + assert(bits != NULL); + if (*bits == 8) printf("%s=%o", s, v); else printf("%s=%x", s, v); Modified: stable/11/usr.sbin/pciconf/cap.c ============================================================================== --- stable/11/usr.sbin/pciconf/cap.c Thu Mar 15 04:59:47 2018 (r330967) +++ stable/11/usr.sbin/pciconf/cap.c Thu Mar 15 05:04:46 2018 (r330968) @@ -161,7 +161,7 @@ cap_pcix(int fd, struct pci_conf *p, uint8_t ptr) printf("supports"); comma = 0; if (status & PCIXM_STATUS_133CAP) { - printf("%s 133MHz", comma ? "," : ""); + printf(" 133MHz"); comma = 1; } if (status & PCIXM_STATUS_266CAP) { @@ -351,10 +351,8 @@ cap_vendor(int fd, struct pci_conf *p, uint8_t ptr) printf("%s SATA RAID-0/1/10", comma ? "," : ""); comma = 1; } - if (fvec & (1 << 3)) { - printf("%s SATA AHCI", comma ? "," : ""); - comma = 1; - } + if (fvec & (1 << 3)) + printf(", SATA AHCI"); } } } Modified: stable/11/usr.sbin/pciconf/pciconf.c ============================================================================== --- stable/11/usr.sbin/pciconf/pciconf.c Thu Mar 15 04:59:47 2018 (r330967) +++ stable/11/usr.sbin/pciconf/pciconf.c Thu Mar 15 05:04:46 2018 (r330968) @@ -1001,6 +1001,7 @@ writeit(const char *name, const char *reg, const char if (ioctl(fd, PCIOCWRITE, &pi) < 0) err(1, "ioctl(PCIOCWRITE)"); + close(fd); } static void @@ -1020,4 +1021,5 @@ chkattached(const char *name) exitstatus = pi.pi_data ? 0 : 2; /* exit(2), if NOT attached */ printf("%s: %s%s\n", name, pi.pi_data == 0 ? "not " : "", "attached"); + close(fd); }