Date: Tue, 15 Jan 2008 19:44:20 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 133340 for review Message-ID: <200801151944.m0FJiKe1094914@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=133340 Change 133340 by hselasky@hselasky_laptop001 on 2008/01/15 19:43:41 Try to work around some compiler warnings "xfer[2] and xfer[3] might be used uninitialized" which is not the case on FreeBSD 7.0-RC1. Reported by "Stefan Lambrev". Affected files ... .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#104 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#104 (text+ko) ==== @@ -2110,31 +2110,33 @@ repeat: xfer[0] = LIST_FIRST(&(info->done_head)); if (xfer[0]) { + do { LIST_REMOVE(xfer[0], done_list); xfer[0]->done_list.le_prev = NULL; xfer[1] = LIST_FIRST(&(info->done_head)); if (xfer[1] == NULL) { dropcount = 1; - goto lockchange_0; + break; } LIST_REMOVE(xfer[1], done_list); xfer[1]->done_list.le_prev = NULL; xfer[2] = LIST_FIRST(&(info->done_head)); if (xfer[2] == NULL) { dropcount = 2; - goto lockchange_0; + break; } LIST_REMOVE(xfer[2], done_list); xfer[2]->done_list.le_prev = NULL; xfer[3] = LIST_FIRST(&(info->done_head)); if (xfer[3] == NULL) { dropcount = 3; - goto lockchange_0; + break; } LIST_REMOVE(xfer[3], done_list); xfer[3]->done_list.le_prev = NULL; dropcount = 4; -lockchange_0: + } while (0); + mtx_unlock(info->usb_mtx); /* @@ -2144,20 +2146,18 @@ mtx_lock(info->priv_mtx); /* call callback(s) */ + switch (dropcount) { + case 4: + usbd_callback_wrapper(xfer[3], info, USBD_CONTEXT_CALLBACK); + case 3: + usbd_callback_wrapper(xfer[2], info, USBD_CONTEXT_CALLBACK); + case 2: + usbd_callback_wrapper(xfer[1], info, USBD_CONTEXT_CALLBACK); + case 1: usbd_callback_wrapper(xfer[0], info, USBD_CONTEXT_CALLBACK); - if (xfer[1] == NULL) { - goto lockchange_1; - } - usbd_callback_wrapper(xfer[1], info, USBD_CONTEXT_CALLBACK); - if (xfer[2] == NULL) { - goto lockchange_1; - } - usbd_callback_wrapper(xfer[2], info, USBD_CONTEXT_CALLBACK); - if (xfer[3] == NULL) { - goto lockchange_1; + default: + break; } - usbd_callback_wrapper(xfer[3], info, USBD_CONTEXT_CALLBACK); -lockchange_1: mtx_unlock(info->priv_mtx); mtx_lock(info->usb_mtx);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801151944.m0FJiKe1094914>