drivers: can: mcan: clear TX callback on failed TX
Elsewhere, "callback != NULL" is used to determine if the callback is in use Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
This commit is contained in:
parent
e98f7b8fb7
commit
08d19954b9
1 changed files with 3 additions and 1 deletions
|
@ -930,12 +930,14 @@ int can_mcan_send(const struct device *dev, const struct can_frame *frame, k_tim
|
|||
|
||||
err = can_mcan_write_reg(dev, CAN_MCAN_TXBAR, BIT(put_idx));
|
||||
if (err != 0) {
|
||||
goto err_unlock;
|
||||
goto err_free_tx_cb;
|
||||
}
|
||||
|
||||
k_mutex_unlock(&data->tx_mtx);
|
||||
return 0;
|
||||
|
||||
err_free_tx_cb:
|
||||
cbs->tx[put_idx].function = NULL;
|
||||
err_unlock:
|
||||
k_mutex_unlock(&data->tx_mtx);
|
||||
k_sem_give(&data->tx_sem);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue