From owner-p4-projects@FreeBSD.ORG Sun Sep 28 19:52:05 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7DE511065694; Sun, 28 Sep 2008 19:52:05 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40DAD106568B for ; Sun, 28 Sep 2008 19:52:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 2F3698FC1D for ; Sun, 28 Sep 2008 19:52:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m8SJq5EC009570 for ; Sun, 28 Sep 2008 19:52:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m8SJq5WV009563 for perforce@freebsd.org; Sun, 28 Sep 2008 19:52:05 GMT (envelope-from hselasky@FreeBSD.org) Date: Sun, 28 Sep 2008 19:52:05 GMT Message-Id: <200809281952.m8SJq5WV009563@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 150621 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Sep 2008 19:52:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=150621 Change 150621 by hselasky@hselasky_laptop001 on 2008/09/28 19:51:37 Revert some changes to "subr_bus.c" . Affected files ... .. //depot/projects/usb/src/sys/kern/subr_bus.c#13 integrate Differences ... ==== //depot/projects/usb/src/sys/kern/subr_bus.c#13 (text+ko) ==== @@ -1879,8 +1879,7 @@ int device_get_children(device_t dev, device_t **devlistp, int *devcountp) { - uint32_t count; - uint32_t n; + int count; device_t child; device_t *list; @@ -1889,34 +1888,14 @@ count++; } - if (count == 0) { - /* avoid zero size allocation */ - n = 1 * sizeof(device_t); - } else { - n = count * sizeof(device_t); - } - - list = malloc(n, M_TEMP, M_NOWAIT|M_ZERO); - if (!list) { - *devlistp = NULL; - *devcountp = 0; + list = malloc(count * sizeof(device_t), M_TEMP, M_NOWAIT|M_ZERO); + if (!list) return (ENOMEM); - } - n = 0; + count = 0; TAILQ_FOREACH(child, &dev->children, link) { - if (n < count) { - list[n] = child; - } - n++; - } - - if (n != count) { - printf("device_get_children: Number of devices changed " - "from %d to %d!\n", count, n); - if (n < count) { - count = n; - } + list[count] = child; + count++; } *devlistp = list;