diff mbox series

usb: core: message: remove memset in usb_get_descriptor()

Message ID 20190629060314.7352-1-cugyly@163.com (mailing list archive)
State Superseded
Headers show
Series usb: core: message: remove memset in usb_get_descriptor() | expand

Commit Message

yuan linyu June 29, 2019, 6:03 a.m. UTC
in the loop, if get a descriptor which is not desired type,
the buf will be not clean.
caller check return length to decide success or not.

Signed-off-by: yuan linyu <cugyly@163.com>
---
 drivers/usb/core/message.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Greg KH June 29, 2019, 7:32 a.m. UTC | #1
On Sat, Jun 29, 2019 at 02:03:14PM +0800, yuan linyu wrote:
> in the loop, if get a descriptor which is not desired type,
> the buf will be not clean.
> caller check return length to decide success or not.

I'm sorry, but I can not understand these sentances at all.  How does
this relate to remiving a memset() call?  Why do you need to, or want
to, remove it?  What does this fix?

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index e844bb7b5676..03425e6b3da9 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -640,8 +640,6 @@  int usb_get_descriptor(struct usb_device *dev, unsigned char type,
 	int i;
 	int result;
 
-	memset(buf, 0, size);	/* Make sure we parse really received data */
-
 	for (i = 0; i < 3; ++i) {
 		/* retry on length 0 or error; some devices are flakey */
 		result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),