Skip to content

Commit dc50ddc

Browse files
Stephane Grosjeanmarckleinebudde
authored andcommitted
can: peak_usb: fix memset() usage
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>
1 parent f2a0151 commit dc50ddc

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎drivers/net/can/usb/peak_usb/pcan_usb_pro.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,6 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
333333
if (!(dev->state & PCAN_USB_STATE_CONNECTED))
334334
return 0;
335335

336-
memset(req_addr, '\0', req_size);
337-
338336
req_type = USB_TYPE_VENDOR | USB_RECIP_OTHER;
339337

340338
switch (req_id) {
@@ -345,6 +343,7 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
345343
default:
346344
p = usb_rcvctrlpipe(dev->udev, 0);
347345
req_type |= USB_DIR_IN;
346+
memset(req_addr, '\0', req_size);
348347
break;
349348
}
350349

0 commit comments

Comments
 (0)