From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754760AbcGYXQw (ORCPT ); Mon, 25 Jul 2016 19:16:52 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36839 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753129AbcGYXPN (ORCPT ); Mon, 25 Jul 2016 19:15:13 -0400 From: "Felipe F. Tonello" To: linux-usb@vger.kernel.org Cc: Felipe Balbi , linux-kernel@vger.kernel.org Subject: [PATCH 1/4] usb: gadget: f_midi: fixed endianness when using wMaxPacketSize Date: Tue, 26 Jul 2016 00:15:03 +0100 Message-Id: <20160725231506.3426-2-eu@felipetonello.com> X-Mailer: git-send-email 2.9.2 In-Reply-To: <20160725231506.3426-1-eu@felipetonello.com> References: <20160725231506.3426-1-eu@felipetonello.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org USB spec specifies wMaxPacketSize to be little endian (as other properties), so when using this variable in the driver we should convert to the current CPU endianness if necessary. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 58fc199a18ec..a83d852b1da5 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c @@ -362,7 +362,7 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt) struct usb_request *req = midi_alloc_ep_req(midi->out_ep, max_t(unsigned, midi->buflen, - bulk_out_desc.wMaxPacketSize)); + le16_to_cpu(bulk_out_desc.wMaxPacketSize))); if (req == NULL) return -ENOMEM; -- 2.9.2