can: peak_usb: fix missing CAN_ERR_FLAG when reporting error counters
PATCH 1/1 can: peak_usb: fix missing CAN_ERR_FLAG when reporting error counters
When the device reports error counters, the driver incorrectly uses an assignment (=) instead of a bitwise OR (|=) for CAN_ERR_CNT. This wipes out the CAN_ERR_FLAG and CAN_ERR_CRTL flags, causing the error frame to be sent to userspace as a regular CAN frame with ID 0x200.
Fix this by using a bitwise OR to preserve the flags.
Signed-off-by Stefan Günther <[email protected]>
--- drivers/net/can/usb/peak_usb/pcan_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/peak_usb/pcan_usb.c +1 -1
@@ -526,7 +526,7 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n,/* Supply TX/RX error counters in case of * controller error. */ - cf->can_id =CAN_ERR_CNT ; + cf->can_id |=CAN_ERR_CNT ; cf->data[6 ] = mc->pdev->bec.txerr; cf->data[7 ] = mc->pdev->bec.rxerr; }
Signature · 1 line
2.43.0