Date: Sun, 28 Sep 2008 19:52:05 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 150621 for review Message-ID: <200809281952.m8SJq5WV009563@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809281952.m8SJq5WV009563>