From owner-svn-src-stable-11@freebsd.org Fri Feb 3 21:37:29 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5190CCCF0FB; Fri, 3 Feb 2017 21:37:29 +0000 (UTC) (envelope-from jhb@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 mx1.freebsd.org (Postfix) with ESMTPS id F318BC1D; Fri, 3 Feb 2017 21:37:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v13LbS3E097064; Fri, 3 Feb 2017 21:37:28 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v13LbSKt097063; Fri, 3 Feb 2017 21:37:28 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201702032137.v13LbSKt097063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 3 Feb 2017 21:37:28 +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: r313175 - stable/11/sys/dev/cxgbe X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2017 21:37:29 -0000 Author: jhb Date: Fri Feb 3 21:37:27 2017 New Revision: 313175 URL: https://svnweb.freebsd.org/changeset/base/313175 Log: MFC 313020: Fix a couple of issues with t4iov probe and attach. - Check for Chelsio vendor ID in probe routines. - Fail attach instead of faulting if pci_find_dbsf() doesn't find a device. PR: 216539 Sponsored by: Chelsio Communications Modified: stable/11/sys/dev/cxgbe/t4_iov.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/t4_iov.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_iov.c Fri Feb 3 20:33:23 2017 (r313174) +++ stable/11/sys/dev/cxgbe/t4_iov.c Fri Feb 3 21:37:27 2017 (r313175) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #endif +#include "common/common.h" #include "t4_if.h" struct t4iov_softc { @@ -106,6 +107,9 @@ t4iov_probe(device_t dev) uint16_t d; size_t i; + if (pci_get_vendor(dev) != PCI_VENDOR_ID_CHELSIO) + return (ENXIO); + d = pci_get_device(dev); for (i = 0; i < nitems(t4iov_pciids); i++) { if (d == t4iov_pciids[i].device) { @@ -123,6 +127,9 @@ t5iov_probe(device_t dev) uint16_t d; size_t i; + if (pci_get_vendor(dev) != PCI_VENDOR_ID_CHELSIO) + return (ENXIO); + d = pci_get_device(dev); for (i = 0; i < nitems(t5iov_pciids); i++) { if (d == t5iov_pciids[i].device) { @@ -140,6 +147,9 @@ t6iov_probe(device_t dev) uint16_t d; size_t i; + if (pci_get_vendor(dev) != PCI_VENDOR_ID_CHELSIO) + return (ENXIO); + d = pci_get_device(dev); for (i = 0; i < nitems(t6iov_pciids); i++) { if (d == t6iov_pciids[i].device) { @@ -161,6 +171,8 @@ t4iov_attach(device_t dev) sc->sc_main = pci_find_dbsf(pci_get_domain(dev), pci_get_bus(dev), pci_get_slot(dev), 4); + if (sc->sc_main == NULL) + return (ENXIO); if (T4_IS_MAIN_READY(sc->sc_main) == 0) return (t4iov_attach_child(dev)); return (0);