Skip to content

Commit

Permalink
can: gs_usb: gs_usb_get_timestamp(): fix endpoint parameter for usb_c…
Browse files Browse the repository at this point in the history
…ontrol_msg_recv()

The 2nd argument of usb_control_msg_recv() is the "endpoint",
usb_control_msg_recv() will internally convert the endpoint into a
pipe with usb_rcvctrlpipe().

In gs_usb_get_timestamp() not the endpoint "0" is passed, but the
pipe. This worked by accident as endpoint is a __u8 and the lowest 8
bits of the pipe are 0. Fix this copy/paste error by using the correct
endpoint of "0".

Fixes: 45dfa45 ("can: gs_usb: add RX and TX hardware timestamp support")
Link: https://lore.kernel.org/all/[email protected]
Cc: John Whittington <[email protected]>
Tested-by: John Whittington <[email protected]>
Signed-off-by: Marc Kleine-Budde <[email protected]>
  • Loading branch information
marckleinebudde committed Sep 23, 2022
1 parent 86c223f commit 593b5e2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/can/usb/gs_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,7 @@ static inline int gs_usb_get_timestamp(const struct gs_can *dev,
__le32 timestamp;
int rc;

rc = usb_control_msg_recv(interface_to_usbdev(dev->iface),
usb_sndctrlpipe(interface_to_usbdev(dev->iface), 0),
rc = usb_control_msg_recv(interface_to_usbdev(dev->iface), 0,
GS_USB_BREQ_TIMESTAMP,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0,
Expand Down

0 comments on commit 593b5e2

Please sign in to comment.