mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] usb/gadget: should use u16 type variable to store MaxPower
@ 2013-12-17 11:47 Du, ChangbinX
  2013-12-19 14:48 ` Felipe Balbi
  0 siblings, 1 reply; 2+ messages in thread
From: Du, ChangbinX @ 2013-12-17 11:47 UTC (permalink / raw)
  To: balbi; +Cc: gregkh, linux-usb, linux-kernel

>From 7e827a0d300e084f74c65122baa5e3193f9a7f18 Mon Sep 17 00:00:00 2001
From: "Du, Changbin" <changbinx.du@intel.com>
Date: Mon, 16 Dec 2013 20:32:13 +0800
Subject: [PATCH] usb/gadget: should use u16 type variable to store MaxPower

The MaxPower field is of u16 type. So using u8 type variable can break
data (high byte lost).

Signed-off-by: Du, Changbin <changbinx.du@intel.com>
---
 drivers/usb/gadget/composite.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 2018ba1..8a34173 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1714,7 +1714,7 @@ composite_resume(struct usb_gadget *gadget)
 {
 	struct usb_composite_dev	*cdev = get_gadget_data(gadget);
 	struct usb_function		*f;
-	u8				maxpower;
+	u16				maxpower;
 
 	/* REVISIT:  should we have config level
 	 * suspend/resume callbacks?
-- 
1.8.3.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb/gadget: should use u16 type variable to store MaxPower
  2013-12-17 11:47 [PATCH] usb/gadget: should use u16 type variable to store MaxPower Du, ChangbinX
@ 2013-12-19 14:48 ` Felipe Balbi
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2013-12-19 14:48 UTC (permalink / raw)
  To: Du, ChangbinX; +Cc: balbi, gregkh, linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 706 bytes --]

On Tue, Dec 17, 2013 at 11:47:42AM +0000, Du, ChangbinX wrote:
> From 7e827a0d300e084f74c65122baa5e3193f9a7f18 Mon Sep 17 00:00:00 2001
> From: "Du, Changbin" <changbinx.du@intel.com>
> Date: Mon, 16 Dec 2013 20:32:13 +0800
> Subject: [PATCH] usb/gadget: should use u16 type variable to store MaxPower
> 
> The MaxPower field is of u16 type. So using u8 type variable can break

Alright I see we need some cleanups around that area in the gadget
framework.

Descriptor is always a u8, no question about it. But
usb_gadget_vbus_draw() receives a u32 as argument, while
struct usb_configuration defines it as u16.

I'll take this patch anyway, as it solves a real issue. Thanks

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-19 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-17 11:47 [PATCH] usb/gadget: should use u16 type variable to store MaxPower Du, ChangbinX
2013-12-19 14:48 ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®