mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
bsp: rockchip: Fix CAN-FD bit timing copy size
RT_CAN_CMD_SET_BITTIMING receives an array of struct rt_can_bit_timing entries. The Rockchip CAN-FD driver used sizeof(&timing->items[n]) when copying those entries, so only pointer-sized bytes were copied into the device configuration. Use the element size so both arbitration and data phase timing structures are copied completely. Generated-by: OpenAI Codex Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
This commit is contained in:
@@ -534,13 +534,13 @@ static rt_err_t rockchip_canfd_control(struct rt_can_device *can, int cmd, void
|
||||
if (timing->count)
|
||||
{
|
||||
rt_memcpy(&can->config.can_timing, &timing->items[0],
|
||||
sizeof(&timing->items[0]));
|
||||
sizeof(timing->items[0]));
|
||||
}
|
||||
|
||||
if (timing->count == 2)
|
||||
{
|
||||
rt_memcpy(&can->config.canfd_timing, &timing->items[1],
|
||||
sizeof(&timing->items[1]));
|
||||
sizeof(timing->items[1]));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user