svn commit: r229124 - stable/9/lib/libusb

Hans Petter Selasky hselasky at FreeBSD.org
Sat Dec 31 15:49:08 UTC 2011


Author: hselasky
Date: Sat Dec 31 15:49:07 2011
New Revision: 229124
URL: http://svn.freebsd.org/changeset/base/229124

Log:
  MFC r228235 and r228236:
  Minor code simplification.
  No functional change.

Modified:
  stable/9/lib/libusb/libusb10.c
Directory Properties:
  stable/9/lib/libusb/   (props changed)

Modified: stable/9/lib/libusb/libusb10.c
==============================================================================
--- stable/9/lib/libusb/libusb10.c	Sat Dec 31 15:49:04 2011	(r229123)
+++ stable/9/lib/libusb/libusb10.c	Sat Dec 31 15:49:07 2011	(r229124)
@@ -417,9 +417,12 @@ libusb_open_device_with_vid_pid(libusb_c
 	if ((i = libusb_get_device_list(ctx, &devs)) < 0)
 		return (NULL);
 
+	pdev = NULL;
 	for (j = 0; j < i; j++) {
-		pdev = devs[j]->os_priv;
-		pdesc = libusb20_dev_get_device_desc(pdev);
+		struct libusb20_device *tdev;
+
+		tdev = devs[j]->os_priv;
+		pdesc = libusb20_dev_get_device_desc(tdev);
 		/*
 		 * NOTE: The USB library will automatically swap the
 		 * fields in the device descriptor to be of host
@@ -427,13 +430,10 @@ libusb_open_device_with_vid_pid(libusb_c
 		 */
 		if (pdesc->idVendor == vendor_id &&
 		    pdesc->idProduct == product_id) {
-			if (libusb_open(devs[j], &pdev) < 0)
-				pdev = NULL;
+			libusb_open(devs[j], &pdev);
 			break;
 		}
 	}
-	if (j == i)
-		pdev = NULL;
 
 	libusb_free_device_list(devs, 1);
 	DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open_device_width_vid_pid leave");


More information about the svn-src-stable-9 mailing list