From owner-svn-src-head@FreeBSD.ORG Sun Aug 25 08:42:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DE1A1965; Sun, 25 Aug 2013 08:42:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B14BD2143; Sun, 25 Aug 2013 08:42:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7P8gpGx047696; Sun, 25 Aug 2013 08:42:51 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7P8gpCl047694; Sun, 25 Aug 2013 08:42:51 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201308250842.r7P8gpCl047694@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 25 Aug 2013 08:42:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254828 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Sun, 25 Aug 2013 08:42:51 -0000 Author: hselasky Date: Sun Aug 25 08:42:50 2013 New Revision: 254828 URL: http://svnweb.freebsd.org/changeset/base/254828 Log: Bugfix: The endpoint profile should only be checked in device mode when allocating USB transfers and not in host mode. Reported by: George Mitchell Modified: head/sys/dev/usb/controller/dwc_otg.c head/sys/dev/usb/controller/musb_otg.c Modified: head/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.c Sun Aug 25 07:46:18 2013 (r254827) +++ head/sys/dev/usb/controller/dwc_otg.c Sun Aug 25 08:42:50 2013 (r254828) @@ -3968,7 +3968,6 @@ done: static void dwc_otg_xfer_setup(struct usb_setup_params *parm) { - const struct usb_hw_ep_profile *pf; struct usb_xfer *xfer; void *last_obj; uint32_t ntd; @@ -4011,16 +4010,21 @@ dwc_otg_xfer_setup(struct usb_setup_para */ last_obj = NULL; + ep_no = xfer->endpointno & UE_ADDR; + /* - * get profile stuff + * Check for a valid endpoint profile in USB device mode: */ - ep_no = xfer->endpointno & UE_ADDR; - dwc_otg_get_hw_ep_profile(parm->udev, &pf, ep_no); + if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) { + const struct usb_hw_ep_profile *pf; - if (pf == NULL) { - /* should not happen */ - parm->err = USB_ERR_INVAL; - return; + dwc_otg_get_hw_ep_profile(parm->udev, &pf, ep_no); + + if (pf == NULL) { + /* should not happen */ + parm->err = USB_ERR_INVAL; + return; + } } /* align data */ Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Sun Aug 25 07:46:18 2013 (r254827) +++ head/sys/dev/usb/controller/musb_otg.c Sun Aug 25 08:42:50 2013 (r254828) @@ -4026,7 +4026,6 @@ done: static void musbotg_xfer_setup(struct usb_setup_params *parm) { - const struct usb_hw_ep_profile *pf; struct musbotg_softc *sc; struct usb_xfer *xfer; void *last_obj; @@ -4088,12 +4087,14 @@ musbotg_xfer_setup(struct usb_setup_para */ last_obj = NULL; + ep_no = xfer->endpointno & UE_ADDR; + /* - * get profile stuff + * Check for a valid endpoint profile in USB device mode: */ - if (ntd) { + if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) { + const struct usb_hw_ep_profile *pf; - ep_no = xfer->endpointno & UE_ADDR; musbotg_get_hw_ep_profile(parm->udev, &pf, ep_no); if (pf == NULL) { @@ -4101,9 +4102,6 @@ musbotg_xfer_setup(struct usb_setup_para parm->err = USB_ERR_INVAL; return; } - } else { - ep_no = 0; - pf = NULL; } /* align data */