Date: Mon, 8 Jun 2009 19:14:18 GMT From: Sylvestre Gallon <syl@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 163819 for review Message-ID: <200906081914.n58JEIwu008132@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=163819 Change 163819 by syl@syl_atuin on 2009/06/08 19:13:43 Fix dead assignments. Fix use of uninitialized value. Fix dereference of undefined value. Found by LLVM/Clang Static Analyzer. Affected files ... .. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.c#26 edit .. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_desc.c#12 edit .. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_io.c#8 edit Differences ... ==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.c#26 (text+ko) ==== @@ -41,7 +41,6 @@ /* * XXX TODO * - implement debug messages. - * - implement last io funcs. */ static pthread_mutex_t default_context_lock = PTHREAD_MUTEX_INITIALIZER; @@ -364,7 +363,7 @@ } libusb_lock_events(ctx); - err = read(ctx->ctrl_pipe[0], &dummy, sizeof(dummy)); + read(ctx->ctrl_pipe[0], &dummy, sizeof(dummy)); pthread_mutex_lock(&ctx->pollfd_modify_lock); ctx->pollfd_modify--; pthread_mutex_unlock(&ctx->pollfd_modify_lock); @@ -381,7 +380,7 @@ struct libusb_device_handle *devh; struct libusb20_device *pdev; struct LIBUSB20_DEVICE_DESC_DECODED *pdesc; - int i, j, k; + int i, j; devh = NULL; @@ -393,7 +392,7 @@ pdesc = libusb20_dev_get_device_desc(pdev); if (pdesc->idVendor == vendor_id && pdesc->idProduct == product_id) - if ((k = libusb_open(devs[j], &devh)) < 0) + if (libusb_open(devs[j], &devh) < 0) devh = NULL; } @@ -438,7 +437,7 @@ } libusb_lock_events(ctx); - err = read(ctx->ctrl_pipe[0], &dummy, sizeof(dummy)); + read(ctx->ctrl_pipe[0], &dummy, sizeof(dummy)); pthread_mutex_lock(&ctx->open_devs_lock); LIST_DEL(&devh->list); pthread_mutex_unlock(&ctx->open_devs_lock); @@ -522,6 +521,7 @@ { int ret; + ret = 0; if (dev == NULL) return (LIBUSB_ERROR_INVALID_PARAM); @@ -735,7 +735,7 @@ usb_backend->flags = 0; if (xfer->timeout != 0) { - ret = clock_gettime(CLOCK_MONOTONIC, &cur_ts); + clock_gettime(CLOCK_MONOTONIC, &cur_ts); cur_ts.tv_sec += xfer->timeout / 1000; cur_ts.tv_nsec += (xfer->timeout % 1000) * 1000000; ==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_desc.c#12 (text+ko) ==== @@ -166,7 +166,7 @@ (*config)->MaxPower = pconf->desc.bMaxPower; (*config)->extra_length = pconf->extra.len; if ((*config)->extra_length != 0) - ifd->extra = pconf->extra.ptr; + (*config)->extra = pconf->extra.ptr; for (i = 0 ; i < nif ; i++) { pinf = &pconf->interface[i]; ==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_io.c#8 (text+ko) ==== @@ -620,7 +620,7 @@ } libusb_free_transfer(xfer); - return (0); + return (ret); } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906081914.n58JEIwu008132>