From owner-svn-src-stable-7@FreeBSD.ORG Fri Oct 8 20:12:01 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15FBF106564A; Fri, 8 Oct 2010 20:12:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 052A48FC08; Fri, 8 Oct 2010 20:12:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o98KC04v011846; Fri, 8 Oct 2010 20:12:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o98KC0VT011844; Fri, 8 Oct 2010 20:12:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010082012.o98KC0VT011844@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 8 Oct 2010 20:12:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213608 - stable/7/sys/dev/sis X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Oct 2010 20:12:01 -0000 Author: yongari Date: Fri Oct 8 20:12:00 2010 New Revision: 213608 URL: http://svn.freebsd.org/changeset/base/213608 Log: MFC r182065: There actually were bugs in the original handling that I missed last night. Free the children after each pci bus that is searched. Otherwise we leak them. With free in the new place, we also have to free children before going to done when we find the device we're looking for. Also, if we can't get the children of a device, just ignore that bus. Modified: stable/7/sys/dev/sis/if_sis.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/sis/if_sis.c ============================================================================== --- stable/7/sys/dev/sis/if_sis.c Fri Oct 8 19:39:35 2010 (r213607) +++ stable/7/sys/dev/sis/if_sis.c Fri Oct 8 20:12:00 2010 (r213608) @@ -347,21 +347,22 @@ sis_find_bridge(device_t dev) devclass_get_devices(pci_devclass, &pci_devices, &pci_count); for (i = 0, busp = pci_devices; i < pci_count; i++, busp++) { - pci_childcount = 0; - device_get_children(*busp, &pci_children, &pci_childcount); + if (device_get_children(*busp, &pci_children, &pci_childcount)) + continue; for (j = 0, childp = pci_children; j < pci_childcount; j++, childp++) { if (pci_get_vendor(*childp) == SIS_VENDORID && pci_get_device(*childp) == 0x0008) { child = *childp; + free(pci_children, M_TEMP); goto done; } } + free(pci_children, M_TEMP); } done: free(pci_devices, M_TEMP); - free(pci_children, M_TEMP); return(child); }