Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Mar 2009 19:20:17 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r189422 - head/sys/dev/usb
Message-ID:  <200903051920.n25JKHPb097210@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Thu Mar  5 19:20:17 2009
New Revision: 189422
URL: http://svn.freebsd.org/changeset/base/189422

Log:
  Fix usb2_poll not to return an error number as the function return value is a
  bitmask of events.
  
  Pointed out by:	HPS

Modified:
  head/sys/dev/usb/usb_dev.c

Modified: head/sys/dev/usb/usb_dev.c
==============================================================================
--- head/sys/dev/usb/usb_dev.c	Thu Mar  5 19:10:17 2009	(r189421)
+++ head/sys/dev/usb/usb_dev.c	Thu Mar  5 19:20:17 2009	(r189422)
@@ -1072,16 +1072,12 @@ usb2_poll(struct cdev* dev, int events, 
 	struct usb2_cdev_privdata* cpd;
 	struct usb2_fifo *f;
 	struct usb2_mbuf *m;
-	int fflags;
-	int err, revents;
-
-	err = devfs_get_cdevpriv((void **)&cpd);
-	if (err != 0)
-		return (err);
+	int fflags, revents;
 
-	err = usb2_ref_device(cpd, 0 /* no uref */ );
-	if (err)
-		return (POLLHUP);
+	if (devfs_get_cdevpriv((void **)&cpd) != 0 ||
+	    usb2_ref_device(cpd, 0) != 0)
+		return (events &
+		    (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM));
 
 	fflags = cpd->fflags;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903051920.n25JKHPb097210>