diff --git a/components/drivers/can/can.c b/components/drivers/can/can.c index f110bc9e1f..eee78da9ec 100644 --- a/components/drivers/can/can.c +++ b/components/drivers/can/can.c @@ -158,10 +158,10 @@ rt_inline int _can_int_tx(struct rt_can_device *can, const struct rt_can_msg *da { /* send failed. */ level = rt_hw_interrupt_disable(); - rt_list_insert_after(&tx_fifo->freelist, &tx_tosnd->list); + rt_list_insert_before(&tx_fifo->freelist, &tx_tosnd->list); rt_hw_interrupt_enable(level); rt_sem_release(&(tx_fifo->sem)); - continue; + goto err_ret; } can->status.sndchange = 1; @@ -189,6 +189,7 @@ rt_inline int _can_int_tx(struct rt_can_device *can, const struct rt_can_msg *da } else { +err_ret: level = rt_hw_interrupt_disable(); can->status.dropedsndpkg++; rt_hw_interrupt_enable(level);