Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751755AbdFZHf2 (ORCPT ); Mon, 26 Jun 2017 03:35:28 -0400 Received: from jusst.de ([188.40.114.84]:36332 "EHLO web01.jusst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751392AbdFZHfO (ORCPT ); Mon, 26 Jun 2017 03:35:14 -0400 Authentication-Results: web01.jusst.de (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=jusst.de From: Julian Scheel To: Greg Kroah-Hartman , Jonathan Corbet , Felipe Balbi , Julian Scheel , Ruslan Bilovol , Peter Chen , Sekhar Nori , Thierry Reding , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH 1/3] usb: gadget: f_uac1: Fix endpoint reading Date: Mon, 26 Jun 2017 09:35:03 +0200 Message-Id: <20170626073505.2792-2-julian@jusst.de> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170626073505.2792-1-julian@jusst.de> References: <20170626073505.2792-1-julian@jusst.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1165 Lines: 32 The endpoint is stored in the lower byte of wIndex, according to USB Audio 1.0 specification, section 5.2.1.1. Signed-off-by: Julian Scheel --- drivers/usb/gadget/function/f_uac1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c index 8656f84e17d9..b955913bd7ea 100644 --- a/drivers/usb/gadget/function/f_uac1.c +++ b/drivers/usb/gadget/function/f_uac1.c @@ -327,7 +327,7 @@ static int audio_set_endpoint_req(struct usb_function *f, { struct usb_composite_dev *cdev = f->config->cdev; int value = -EOPNOTSUPP; - u16 ep = le16_to_cpu(ctrl->wIndex); + u8 ep = le16_to_cpu(ctrl->wIndex) & 0xff; u16 len = le16_to_cpu(ctrl->wLength); u16 w_value = le16_to_cpu(ctrl->wValue); @@ -363,7 +363,7 @@ static int audio_get_endpoint_req(struct usb_function *f, { struct usb_composite_dev *cdev = f->config->cdev; int value = -EOPNOTSUPP; - u8 ep = ((le16_to_cpu(ctrl->wIndex) >> 8) & 0xFF); + u8 ep = le16_to_cpu(ctrl->wIndex) & 0xff; u16 len = le16_to_cpu(ctrl->wLength); u16 w_value = le16_to_cpu(ctrl->wValue); -- 2.13.1