Commit 6b4be543 authored by Stephane Grosjean's avatar Stephane Grosjean Committed by Jiri Slaby

can: peak_usb: fix memset() usage

commit dc50ddcd upstream.

This patchs fixes a misplaced call to memset() that fills the request
buffer with 0. The problem was with sending PCAN_USBPRO_REQ_FCT
requests, the content set by the caller was thus lost.

With this patch, the memory area is zeroed only when requesting info
from the device.
Signed-off-by: default avatarStephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent e1f20f1d
...@@ -333,8 +333,6 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id, ...@@ -333,8 +333,6 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
if (!(dev->state & PCAN_USB_STATE_CONNECTED)) if (!(dev->state & PCAN_USB_STATE_CONNECTED))
return 0; return 0;
memset(req_addr, '\0', req_size);
req_type = USB_TYPE_VENDOR | USB_RECIP_OTHER; req_type = USB_TYPE_VENDOR | USB_RECIP_OTHER;
switch (req_id) { switch (req_id) {
...@@ -345,6 +343,7 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id, ...@@ -345,6 +343,7 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
default: default:
p = usb_rcvctrlpipe(dev->udev, 0); p = usb_rcvctrlpipe(dev->udev, 0);
req_type |= USB_DIR_IN; req_type |= USB_DIR_IN;
memset(req_addr, '\0', req_size);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment