Skip to content

Commit

Permalink
can: peak_usb: fix memset() usage
Browse files Browse the repository at this point in the history
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: Stephane Grosjean <s.grosjean@peak-system.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Stephane Grosjean authored and Marc Kleine-Budde committed Dec 6, 2014
1 parent f2a0151 commit dc50ddc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/can/usb/peak_usb/pcan_usb_pro.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
return 0;

memset(req_addr, '\0', req_size);

req_type = USB_TYPE_VENDOR | USB_RECIP_OTHER;

switch (req_id) {
Expand All @@ -345,6 +343,7 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
default:
p = usb_rcvctrlpipe(dev->udev, 0);
req_type |= USB_DIR_IN;
memset(req_addr, '\0', req_size);
break;
}

Expand Down

0 comments on commit dc50ddc

Please sign in to comment.