From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 19:20:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB3B91065678; Thu, 5 Mar 2009 19:20:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9DCE8FC0C; Thu, 5 Mar 2009 19:20:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n25JKHLe097211; Thu, 5 Mar 2009 19:20:17 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25JKHPb097210; Thu, 5 Mar 2009 19:20:17 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903051920.n25JKHPb097210@svn.freebsd.org> From: Andrew Thompson Date: Thu, 5 Mar 2009 19:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189422 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 19:20:18 -0000 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;